I had a similar problem w/ my son and wetting to bed. It would get very frustrating that he would come in and wake me up to change the sheets. He was older than 4 so he was capable of doing it himself. It was a short stage, but frustrating.
During a counciling session for his ADHD the councilor told me let him change the sheets AND do the laundry. He did the mess let him clean it. You may be thinking, she is 4, how can I do that. I have a friend I worked with and her 5 yr old was doing her own laundry! I was amazed as my 7 and 9 yr old werent. So we have them bring down the dirty clothes, show them how to put in detergent, turn it on, put in the clothes and even put them in the dryer, fold and put them away.
If she has to do it all, just possibly that may work. Make sure your explaining that its not healthy for her body to hold it in and it could make her ill, therefore if she chooses to mess in her pants, she will have to clean up the mess.
Kids are smarter than we give them credit and at times need to get all the information so they can see the big picture.
Best of luck.