conditional import into global namespace
mk
mrkafk at gmail.com
Tue Mar 2 15:41:44 EST 2010
Jerry Hill wrote:
> Just import subprocess at the top of your module. If subprocess
> hasn't been imported yet, it will be imported when your module is
> loaded. If it's already been imported, your module will use the
> cached version that's already been imported.
>
> In other words, it sounds like Python already does what you want. You
> don't need to do anything special.
Oh, thanks!
Hmm it's different than dealing with packages I guess -- IIRC, in
packages only code in package's __init__.py was executed?
Regards,
mk
More information about the Python-list
mailing list