title: What happens when using mutual or circular (cyclic) imports in Python?
body: <p>In Python, what happens when two modules attempt to <code>import</code> each other? More generally, what happens if multiple modules attempt to <code>import</code> in a cycle?</p>
  <hr />
  <p><sub>See also <a href="https://stackoverflow.com/questions/9252543/">What can I do about &quot;ImportError: Cannot import name X&quot; or &quot;AttributeError: ... (most likely due to a circular import)&quot;?</a> for the common problem that may result, and advice on how to rewrite code to avoid such imports. See <a href="https://stackoverflow.com/questions/22187279">Why do circular imports seemingly work further up in the call stack but then raise an ImportError further down?</a> for technical details on <strong>why and how</strong> the problem occurs.</sub></p>