I was wondering if penalties during a punt are treated as penalties during a change of possession if their are penalties on both teams.
The situation I am wondering about is if we have a roughing (15 yard) the punter but also a personal foul against the kicking team.
Does it matter when the foul against the kicking team occurred and how would they be enforced?
If both fouls are before the change of possession, it's an automatic offset. The only exception is if R's foul is a post-scrimmage kick foul (PSK). This means that it is treated as if it had happened after possession changed (after the kick ends).
Look at the definition of PSK to grasp the full rule, but the essence of the rule is that if the foul by R is part of the punt rush, it's previous spot enforcement. If it's part of the punt coverage, it's PSK. That's what the rule is trying to say.
In your example you have Roughing. This is previous spot enforcement since it was part of the punt rush.
If K's personal foul occurs before the end of the kick, these would automatically offset.
If K's personal foul occurs during the return, that actually would offset too, since R's foul is previous spot and not PSK. R did not get the ball with clean hands and K also fouled, therefore we have an offset.