how can I replace a execfile with __import__ in class to use self variables

Wensheng wenshengwang at gmail.com
Wed Feb 9 22:37:00 EST 2005


I just realized I can pass the object itself:
like
p=__import__("printit")
p.pr(self)

in printit.py
-------------
def pr(self):
    print self.var
-------------------




More information about the Python-list mailing list