Running code on module import

Grant D. Watson vbasicboy at aol.com
Sat May 22 04:13:02 EDT 2004


>This works so long as runmain is the first module imported by any module that
>uses it.

No sooner said than I find that this doesn't work in my rewrite, only in my
first "version" (prototype is more like).  Anyway, I suspect that this is
because in the first one I used a recursive import.  (Is this dangerous?  It
seems like it ought to be.)  In the second one I tried to find the main()
function in the module object when the  module hadn't finished initializing
yet.

Am I attempting the impossible, here?  Will recursive imports burn me?

Grant D. Watson
grant_watson at yahoo.pleasedontspamme.com
(Please use this address, not my AOL one.)



More information about the Python-list mailing list