So I'm trying to write a function to instantiate a class. Since I am looping through said function, I need a condition so the function only instantiates the class if it has not yet been done (otherwise HP would be maxed out every loop, among other problems). Something I tried:
class Fighter:
def __init__(self):
self.maxHP = 100
self.HP = self.maxHP
self.attack = 10
def before_fight():
if fighterYOU == None: #this is where I would like a condition that checks if fighterYOU is already instantiated. "None" does not work.
fighterYOU = Fighter()
fighterYOU.update()
fight()
before_fight()
#...program continues
Is a check like this possible, or should I just try moving the instantiation somewhere else, where it won't be looped through?