I want to have a global variable x
that can be accessed by multiple object instances:
The module Obj
should have something like:
x = 0
class Obj:
def set_x(self):
global x
x = 2
def print_x(self):
print x
...etc.
The other module (ex: main) instantiates the object obj:
obj1 = Obj.Obj()
obj1.set_x()
obj2 = Obj.Obj()
obj2.print_x
this should print 2