Wash the kidney beans very well, and soak in enough water and keep overnight or at least for about 6 hours.
Once the beans is soaked, drain the water and wash again in water.
Transfer the soaked kidney beans to the instant pot.
Slice the onions and chop the tomatoes, add them to the instant pot.
Also add the spice powders, garlic, ginger, green chilies (if using) and oil to the instant pot.
Add the water and enough salt, mix everything well.
Close the instant pot with lid in sealing position and cook in high pressure for about 35 minutes.
Wait for a natural pressure release, if you are in a hurry, you may do a careful gradual manual pressure release after about 15 minutes of natural pressure release.
Once the pressure is all released, carefully open the instant pot.
Stir well the contents, simmer if desired (using saute function) for a couple of minutes. Also you may add a couple of spoons of heavy cream or coconut milk if you wish and also garnish with chopped cilantro leaves.
Serve the prepared delicious rajma masala with rice or chapathi or poori. You may also enjoy this as a healthy, nutritious soup or vegetarian stew or chili.