The problem is that the interpreter will do things in the following order:

The main program imports foo

Empty globals for foo are created

foo is compiled and starts executing

foo imports bar

Empty globals for bar are created

bar is compiled and starts executing

bar imports foo (which is a no-op since there already is a module named foo)

bar.foo_var = foo.foo_var

The last step fails, because Python isn’t done with interpreting foo
yet and the global symbol dictionary for foo is still empty.

The same thing happens when you use import foo, and then try to access
foo.foo_var in global code.

There are a few ways to get around this problem:

The preferred way is simply to avoid recursive use of from-import, placing all code inside functions.
Initializations of global variables and class variables should use
constants and built-in or locally defined functions only. This means
everything from an imported module is referenced as
<module>.<name>.