title: How to solve infinite loop import?
body: <p>I want to understand the root of my problem. I have encountered this a couple times and it is quite time consuming to figure it out each time.</p>
  <p>This time I feel like I have missed something that I thought I understood.
  A related question is posted here: <a href="https://stackoverflow.com/questions/12474374/infinite-loop-with-python-imports-looking-for-pythonic-way">Infinite loop with Python imports; looking for Pythonic way</a></p>
  <p>I decided my modules present an infinite loop, but I still get the same error. so here are what I have.
  I have included <code>__init__.py</code> files here too because I suspect that this file might cause behavior that I am currently unaware of.</p>
  <p>In <code>sources/preparation/features/__Init__.py</code>:</p>
  <pre><code>from .build_features import *
  from .get_qualified_edges import *
  from .select_strategy import *
  from .test import *
  </code></pre>
  <p>In <code>sources/preprocessing/__init__.py</code>, I have:</p>
  <pre><code>from .apply_preprocessing import *
  from .convertion import *
  </code></pre>
  <p>In <code>sources/preprocessing/apply_preprocessing</code> I have:</p>
  <pre><code>from Sources.Preparation.Features.get_qualified_edges import get_all_GeneDisease_unweighted_disease2disease_qualified_edges
  from Sources.Preparation.Features.get_qualified_edges import get_GPSim_disease2disease_qualified_edgesjk
  </code></pre>
  <p>In directory <code>source/preparation/features/get_qualified_edges.py</code>:</p>
  <pre><code>from Sources.Preprocessing.convertion import Converter # added this lien causes error to be raised
  from itertools import combinations
  </code></pre>
  <p>In <code>Sources/preprocessing/conversion.py</code> I don't have anything imported.</p>
  <p>Below are the sequence of files that are run because error arise:</p>
  <pre class="lang-none prettyprint-override"><code>sources\__init__.py
  sources\preparation\__init__.py
  sources\prepartion\features\__init__.py
  sources\preparation\features\build_features.py
  sources\preparation\features\get_qualified_edgdes.py
  sources\preprocessing\__init__.py
  sources\preprocessing\apply_preprocessing.py
  \\error raise
  </code></pre>
  <p>The error is raised when I import a class from <code>Sources.Preprocessing.convertion</code> as shown below. In <code>source/preparation/features/get_qualified_edges.py</code>:</p>
  <pre><code>from Sources.Preprocessing.convertion import Converter # added this lien causes error to be raised
  </code></pre>
  <p>Let me know if you folks need more information about this problem.</p>
  <p>What I want to know is: <strong>Why does this problem occur?</strong>
  I solved the problem when I moved <code>Converter</code> from <code>Sources.Preprocessing.convertion</code> to <code>Sources.Preparation.Data.conversion</code>.</p>
  <h3>Observation</h3>
  <p>What I observed is that the error disappeared when there are no &quot;cross&quot; imports between <code>Sources.Preprocessing.modules_A</code> (imported in <code>Sources.Preparation.modules_C</code>) and <code>Sources.Preparation.modules_B</code> (imported in <code>Sources.Preprocessing.modules_D</code>).</p>
  <p>That's it. There are no direct &quot;cross&quot; imports between modules and instead there are &quot;cross&quot; imports between parent modules, if that makes any sense.</p>