some import / namespace questions

stef mientki s.mientki at mailbox.kun.nl
Wed Aug 8 11:11:19 EDT 2007


hello,

I'm working on a rather strange program,
that is partially build dynamically,
and where users can create plugins,
without knowing any of the details of the core program.

Of course this leads to some weird bugs,
so one of the things I want to view/log is the order (and even better 
the way) modules are imported.
For now I've put a print statement in every module.
But is there a more elegant way to see when (how, by which module ) a 
module is imported ?

The main plugin of the user (with a fixed name, let's say 
"Main_User.py") has a an (almost) infinite loop,
which can be aborted by raising an exception.
Now I have to make a few globals from this user module,
available to other existing modules.
I already created a list of these globals.
Now it's not possible to import in the existing modules the main plugin, 
like
   from Main_User import *
because this will start the infinite loop.
Is there a way of getting the list of collected globals from Main_User 
to the existing modules,
without the standard import statement shown above ?

thanks,
Stef Mientki





More information about the Python-list mailing list