variant 1 has to check every method in your script, which, depending on how many methods your player has, can take more time. Plus this check seems unnecessary since we assume the player always has such a method, unless you plan to create additionally , invulnerable players.
I would change variant 1 into a group… I call them entities, put every enemy and player in it and check with if body.is_in_group("entities")
but Variant 2 is fine but a bit prone to errors, you have to change the code every time you change the player objects name.