I have a class instance instance_1
.
How can I create another variable that always holds an up to date reference to instance_1
?
This one does not work:
class my_class():
def __init__(self):
self.my_a = 44
def update_my_a(self):
self.my_a = 33
instance_1 = my_class()
my_var = instance_1.my_a
instance_1.update_my_a()
print(instance_1.my_a)
>>33
print(my_var)
>>44