S.K.
Do not punish him. Kids often regress after bringing home a new baby. I think it's a cry for extra attention. Instead of punishing him, try praising him when he doesn't mess his pants at school or at home. Some kids respond better that way. Maybe set aside extra special time when he does a good job. Let him know, if he does a good job for a week, you'll do something special with him like go somewhere he enjoys or take him for ice cream or something do a puzzle with him.