
Josiah Carlson wrote:
How is this mechanism supposed to behave in the presence of things like...
# baz.py from foo lazy import bar
def fcn(): return bar.obj(...)
I would say "don't do that". If bar is always used within the baz module, there's no reason to lazily import it -- just use an ordinary import. If you're trying to achieve a conditional import, use an ordinary import that's executed conditionally, e.g. if moon_is_full: from foo import bar frobnicate(bar) Then py2exe will notice the potential for importing the foo module and include it. The only time you should use a lazy import is in the situation I described, i.e. you're importing things solely to re-export them for other modules that may want to use them. Any module that actually uses something itself, even if only potentially, should use a normal import. -- Greg