AI engineering glossary · Python advanced
What is circular import?
Circular import: A situation where two modules import each other, directly or through a chain, so one is used before it has finished loading. It usually raises an ImportError and is fixed by restructuring or delayed imports.
Circular import: an example
a.py imports b.py, which imports a.py again, and accessing a name from a partly loaded module fails.
Related terms
More Python advanced terms
Where you learn it
Circular import is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.