We’re in exactly the same situation, he poos exclusively in pants after starting potty training almost 4 months ago. He now tells us when he needs a poo but if we suggest potty he’s very resistant. And just instantly says ‘I did it, I did poo poo in my pants” I don’t see how it will ever stop. Sorry, not helpful for you. But hopefully someone will comment with a magic solution for us all. X
If he's regular about time of day, maybe you could try getting him on the toilet and reading books or playing with a favorite toy so he stays a while around that time? Mine also really needed privacy for poo. He had a little potty in his room during quiet time, and used that for poo every day for a while. Sounds like yours needs privacy too. So get him to the toilet then step out to "get something" and let him be. Also, there's a play doh trick for showing kids what happens when you poop. It's described in the oh crap potty training book, and might help? Basically you squeeze play doh (brown if you have it) out between your thumb and pointer finger, describing what part of the poo process is happening throughout. Sometimes they don't recognize that it's coming out until it is already out!
This probably won’t be what you want to hear but my son is exactly the same and has been for a year we started potty training last August (he was 3 in January) and still poos his pants regularly, he’s been on laxatives for months because he holds on so much he gives himself a bad tummy. I’ve tried everything to get him to stop pooing himself and nothing has worked. Fingers crossed your son gets it soon 🤞🏻