Import question

Lonnie Princehouse finite.automaton at
Tue Aug 9 21:21:59 CEST 2005

Circular import issues can usually be resolved by moving import
statements into the bodies of functions which aren't executed when the
module itself is imported.  Simple example:

---- ------

import fileB as fb
foo = 10    # we're going to access foo from fileB


---- ------

def do_something_with_foo():
   import fileA as fa  # import is INSIDE the function
   print "foo is ",


More information about the Python-list mailing list