How/where does Python look for modules?
<p>I am completely new to Python and wanted to use py2neo and tornado module.</p>

<p>In order to do that I ran setup.py for both modules and placed them into folders</p>

<pre><code>C:\Python32\modules\py2neo
</code></pre>

<p>and</p>

<pre><code>C:\Python32\modules\tornado
</code></pre>

<p>In the main program I guess these lines tell the interpreter where to look for files:</p>

<pre><code>import sys
sys.path.append(r'C:\Python32\modules')



# Import Neo4j modules
from py2neo import neo4j, cypher
</code></pre>

<p>Reading the book I also added environmental variable (in Windows 7)</p>

<pre><code>PYTHONPATH = C:\Python32\modules;C:\Python32\modules\tornado;C:\Python32\modules\py2neo
</code></pre>

<h1>Edit</h1>

<p>Now I figured out that Python Shell has to be restarted in order to load modified PYTHONPATH variable
 In case the variable value is <code>PYTHONPATH = C:\Python32\modules</code>
and the program contains the line </p>

<pre><code>from py2neo import neo4j, cypher
</code></pre>

<p>then the following lines are useless:</p>

<pre><code>import sys
sys.path.append(r'C:\Python32\modules')
</code></pre>

<p>When I run the program however I get the following error:</p>

<pre><code>Traceback (most recent call last):
  File "C:\...\Python Projects\HelloPython\HelloPython\Hellopy2neo.py", line 15, in &lt;module&gt;
    from py2neo import neo4j, cypher
  File "C:\Python32\modules\py2neo\neo4j.py", line 38, in &lt;module&gt;
    import rest, batch, cypher
ImportError: No module named rest
</code></pre>

<p>In the file neo4j.py there are the following lines:</p>

<pre><code>try:
    import json
except ImportError:
    import simplejson as json
try:
    from urllib.parse import quote
except ImportError:
    from urllib import quote
try:
    from . import rest, batch, cypher
except ImportError:
    import rest, batch, cypher #line38
</code></pre>

<p>and rest.py file is located in folder <code>C:\Python32\modules\py2neo</code> so I don't know why I get the error </p>

<blockquote>
  <p>ImportError: No module named rest</p>
</blockquote>

<h1>Edit2:</h1>

<p>Trying to import the py2neo directoy in Python Shell and list modules I get:</p>

<pre><code>&gt;&gt;&gt; import py2neo
&gt;&gt;&gt; [name for name in dir(py2neo) if name[0] != '_']
['rest']
</code></pre>

<p>I guess there are some unneccesary imports as well and would be very thankful if anyone explained, which imports should be added and excluded (in PYTHONPATH and scripts) in order the program to run without errors.</p>
