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

2005-02-10 Thread Jeff Shannon
Wensheng wrote: I just realized I can pass the object itself: like p=__import__("printit") p.pr(self) Leaving no reason not do do *this* part as import printit printit.pr(self) rather than using the internal hook function to do exactly the standard thing. in printit.py - def p

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

2005-02-09 Thread Wensheng
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 --- -- http://mail.python.org/mailman/listinfo/python-list

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

2005-02-09 Thread Wensheng
I have a py program below: class someclass: def __init__(self): self.var = "hell, world" def printitout(self): execfile("printit.py") #__import__("printit") #doesn't work if __name__=="__main__":