Thank you for the input.
Constipation is often a cause for such symptoms.
Anxiety, stress can be a factor.
There can be a problem in the school.
When he is having stomach pain
, itching, you need to rule out a physical cause first.
An infection, worm can cause frequent small stool.
An urinary tract infection needs to be ruled out too.
An urine and stool analysis can be taken.
I feel you need to consult his pediatrician first.
Doctor can make initial evaluation, take tests.
If he does not find any physical issues, he can then refer for psychological evaluation.
Meanwhile, you can try to make your baby sit daily for several times, though he was well potty trained.
It can be made a daily habit to use potty after breakfast, snacks, before going out, before sleep etc.
Try to praise when the baby is using the potty.
You can give some incentives when he uses the potty, even if it is unsuccessful.
Don't rebuke but just express that it is not good when he soils.
If you have any query, please feel free to ask and continue conversation by using REPLY button.
This will help me to explain further & satisfy you.
PLEASE DO NOT RATE MY ANSWER TILL YOU WANT TO KNOW MORE and rate it as EXCELLENT / GOOD SERVICE when you are satisfied.
Wish his healthy life.