How to import a python file in a parent directory
<p>If I have the following directory structure:</p>

<pre><code>parent/
    - __init__.py
    - file1.py
    - child/
        - __init__.py
        - file2.py
</code></pre>

<p>In file 2, how would I import file 1?</p>

<p><strong>Update</strong>:</p>

<pre><code>&gt;&gt;&gt; import sys
&gt;&gt;&gt; sys.path.append(sys.path.append('/'.join(os.getcwd().split('/')[:-2])))
&gt;&gt;&gt; import parent
&gt;&gt;&gt; ImportError: No module named parent
</code></pre>
