some import / namespace questions

stef mientki s.mientki at
Wed Aug 8 17:11:19 CEST 2007


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 
"") 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, 
   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 ?

Stef Mientki

More information about the Python-list mailing list