how to include a file -- not import??

Darrell darrell at dorb.com
Thu Jan 6 11:58:46 EST 2000


From: "Andrew Csillag" <andrew at starmedia.net>
> Darrell wrote:
> > 
> > from filename import *
> 
> Actually, that doesn't do it either if the other module wants to
> reference vars in the importing namespace.
> 
> The way to make it so that the other code can access variables in the
> including files namespace is:
> exec open('filename').read() 
> 

Got me on that one.
It never occured to me to do something like this :-/
I'm thinking this isn't a good thing. 

--Darrell






More information about the Python-list mailing list