I read some posts regarding how we can create a shared variable among class instances in python. One way to do it is to define this variable before class initialization. While this works for variables, it seems it doesn't work for what I want.
class C1:
def __init__(self, a, b):
self.c = a + b
class C2:
obj1 = C1(x,y)
def __init__(self):
self.d = 1
obj2 = C2
How can we set variables x and y for the instance obj1 of class C1? If we define this instance inside C2 initialization, then we could write
obj2 = C2(var1,var2)
But, now that it is outside C2 initialization, I don't know how to do it. Any idea?