Cannot resolve "import as" situation ("AttributeError module x has no attribute y") Cannot resolve "import as" situation ("AttributeError module x has no attribute y") python-3.x python-3.x

Cannot resolve "import as" situation ("AttributeError module x has no attribute y")


You have circular dependent imports. you try to execute

import lib.core.common as abc

in two files, in driver.py and in util.py

The easiest way to fix this is to move the path import to the end of the node module, some docs,or

def dostuff():    from foo import bar    ...

or this also will work,

from lib.core import common as abc

When Python imports a module, it checks the module registry to see if the module was already imported. If the module was already registered, Python uses that existing object from cache. The module registry is a table of modules that have been initialized and indexed by module name. This table can be accessed through sys.modules.

If it was not registered, Python finds the module, initializes it if necessary, and executes it in the new module's namespace.