Four year old will not poop in potty

She’s done great with peeing for about a year but will not poop in the potty. She doesn’t wear pull ups ever. She wakes up to pee and doesn’t wet the bed. She just poops in her underwear every single time and then cries and wants changed. Idk what to do. She goes to preschool but is only there 2.5 hours so she just holds it until she gets home and goes in her panties. She turns 5 in November and I just don’t know what to do......

Edit: she definitely knows when she has to poop because she’ll go to the same spot and try to hide and sometimes say “I have to poop” but when I take her to the potty she won’t and then she’ll go on herself.