Yes, you have to check if the body is the player character somehow. On way to do it is to add a player character to a group called “player” or “hero” as you called it, doesn’t matter. Then check if the body is in sad group:
if body.is_in_group("player"):
#pick up coin