Parametrized module import
Jacek Generowicz
jacek.generowicz at cern.ch
Thu Jul 8 08:22:25 EDT 2004
More information about the Python-list mailing list
Thu Jul 8 08:22:25 EDT 2004
- Previous message (by thread): Parametrized module import
- Next message (by thread): Parametrized module import
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Heather Coppersmith <me at privacy.net> writes: > Upon import, a module's "top level" code is executed, Yes, but only on the _first_ import. On subsequent imports the system notices that the module has already imported, and doesn't execute anything in the module, it just binds a name to the already imported module ... > so try a variation on this theme at the top level of your module: > > i_am_configured = False > > if i_am_configured: > print 'i am already configured' > else: > import my_configuration_module > configure_myself( ) > i_am_configured = True ... so the first branch will _never_ get executed. My question is exactly about this problem: nothing gets executed on the second import, so there's nowhere for me to put the "already configured" message.
- Previous message (by thread): Parametrized module import
- Next message (by thread): Parametrized module import
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list