There's GOT to be a better way!
gaudetteje at gmail.com
gaudetteje at gmail.com
Thu Mar 3 19:10:36 EST 2005
This would be a good case to use OO design, imo. The following works
fine. Simply instantiate the object, call the method, and you can
access (and manipulate) the "module's" variable to your heart's
content.
module.py
class object:
def __init__(self):
self.test = 1
def A(self):
for x in range(10): self.B()
def B(self):
self.test = self.test + 1
main.py
from module import object
MyObj = object()
print MyObj.test
MyObj.A()
print MyObj.test
More information about the Python-list
mailing list