how can I replace a execfile with __import__ in class to use self variables
Jeff Shannon
jeff at ccvcorp.com
Thu Feb 10 13:11:28 EST 2005
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 pr(self):
> print self.var
> -------------------
(Though frankly I don't see the advantage of having this tiny function
in a separate file to begin with...)
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list