I'm trying to use the variable name of my class inside of a method in my class, but I have no idea how to do it. To better explain here is an example.
class Pet():
def __init__(self, name, species):
self.name = name
self.species = species
def petVar(self):
print(f"{str(__name__)} is the name of the variable")
pet1 =Pet("peter", "cat")
pet1.petVar()
#output
'__main__ is the name of the variable'
The output I would want here would be 'pet1 is the name of the variable'. I understand it might be confusing why I might would try to do this, but this is a simplified version of my issue which is causing me a larger problem in my code.
Appreciate anyone who can help.