Heat a pan on a low flame and toast the peanuts . When they're lightly toasted, add the coconut and continue to toast till the coconut is lightly browned. Keep stirring to ensure that they don't burn.
Put in the coriander, cumin and sesame seeds and toast for 2 more minutes. Take the pan off the heat and allow it to cool.
When the mixture has cooled, transfer it to a blender/spice grinder along with the rest of the masala ingredients, a little salt and a couple of tablespoons of water (used as little water as possible, the masala has to be thick enough to stuff into the eggplants), and process to a paste.
Use most of the paste to stuff into each eggplant. Set aside the rest to make the sauce / gravy.
Heat 1-2 tbsp oil in the same pan on low-medium heat and fry the baingans, a few at a time, so that they are browned and half cooked. Set aside.
In the same pan, heat the remaining oil and sauté the onions till translucent, add the remaining masala and cook for 30 seconds. Pour in the tamarind pulp and a little water to loosen the mixture to the consistency of a reasonably thick gravy (be careful not to add too much because it will dilute the flavours of the masala). Allow the sauce to come to a low simmer, then carefully put in the eggplants in a single layer so that they don't break. Cover and cook for 7-10 mins till the eggplants are just about cooked through and the rawness of the tamarind has disappeared. Do not let the baingan overcook and turn mushy. They must retain their shape.
Taste to check the balance of sourness, sweetness and sourness, season if required and take off the heat.