C.F.
Been there done that, with my own and my preschoolers. I put them in charge. they can poop in the potty or in their pants, but they clean it up. I also talk with them about how it does not get on their bottoms or on their clothes if they poop in the potty and point out how yucky it feels and how messy it is if they poop in their pants. Usually they go in their pants because then they do not have to touch it and someone else cleans them up.
If they poop in their pants, I will talk them through how to change, tell them each step to take, but I will not do it for them. They always seem to decide to go potty after a few times of cleaning themselves up.
I do try to watch them and send them to the potty if I see they need to have a bm.
Good luck!