import namespace issues

Alex new_name at mit.edu
Tue Jul 10 06:01:49 EDT 2001


> I have to separate a module's function into two .py-files. Now I would
> like to import both in a way that they behave like they are one file.

Why do you want to do this?

I guess if you put something like this in first.py, it ought to roughly
work:

import second
for attr in dir(secord):
    exec '%s = second.%s' % (attr, attr)

...but if you give some more details about what you're really trying to
achieve, people might be able to come up with a cleaner solution.

HTH.
Alex.



More information about the Python-list mailing list