Who is a Fish expert cause i need help?

  I have a pregnant molly in my fish tank and my other fish kept bothering it by nipping and the belly, and rubbing aggressively on it (and no it did not get the molly pregnant because we just bought the molly yesterday). It did that to the other fish as well so i took it out of the tank before anything else happened. Should i put it back in or did i do the right thing.
you did the right thing just leave her in another tank and wait until she has the babies. After she has the babies then attempt to put her back she then will be able to defend herself and get them to stop. Go on google and search up how to take care of molly babies so u will know.
you should take it out and put it in another tank, if you dont wanna do that, maybe get a breeding trap.