Re: Importing a file into another module's namespace

2009-04-28 Thread Steven D'Aprano
On Tue, 28 Apr 2009 17:26:22 -0500, Gary Oberbrunner wrote: > Hi Steven (and MRAB), thanks for this idea. This looks pretty > straightforward and useful. I also heard of another way via googling > around; see what you think of this. For example's sake this code just > adds stuff to the os.path

Re: Importing a file into another module's namespace

2009-04-28 Thread Gary Oberbrunner
- "Steven D'Aprano" wrote: > On Mon, 27 Apr 2009 21:46:13 -0400, Gary Oberbrunner wrote: > > > ...Now after importing foo.bar, I'd like to load > > another file of code (say xyz.py), but *into* foo.bar's namespace. ... > > import foo.bar > import xyz > for name in dir(xyz): > if not n

Re: Importing a file into another module's namespace

2009-04-27 Thread Steven D'Aprano
On Mon, 27 Apr 2009 21:46:13 -0400, Gary Oberbrunner wrote: > I have a module, foo.bar, that defines a number of functions and > variables as usual. Now after importing foo.bar, I'd like to load > another file of code (say xyz.py), but *into* foo.bar's namespace. So > if xyz.py contains: > > de

Re: Importing a file into another module's namespace

2009-04-27 Thread MRAB
Gary Oberbrunner wrote: Hi; my first time posting here. I have a somewhat tricky problem I'd like some help with. I have a module, foo.bar, that defines a number of functions and variables as usual. Now after importing foo.bar, I'd like to load another file of code (say xyz.py), but *into* foo

Importing a file into another module's namespace

2009-04-27 Thread Gary Oberbrunner
Hi; my first time posting here. I have a somewhat tricky problem I'd like some help with. I have a module, foo.bar, that defines a number of functions and variables as usual. Now after importing foo.bar, I'd like to load another file of code (say xyz.py), but *into* foo.bar's namespace. So if x