June 2017
Beginner to intermediate
274 pages
6h 49m
English
There is something that might trip us up when we're importing a module that shares the same package. Sometimes, the module we're importing wants to import us as well. This is called a cyclic dependency. When we try to import a cyclic dependency, we'll almost always get an attribute error exception, as in the following example:

That happens because when we ask Python to import the first module, Python immediately creates a module object for it and begins executing the code in the module.
That's fine, except that, when Python gets to the import statement for the next module in this cycle, it pauses running the code ...
Read now
Unlock full access