Python Import specific file or directory
<p>I want to import file 'a' into file 'b' how to do it ? I tried with os,sys etc but it doesnt work for me. I just want to go 2 folders up and go into file a. I hope that its understable.</p>

<p>file a : C:\Web\Tests\Current\Automated tests\Common\extensions\file.py</p>

<p>file b: C:\Web\Tests\Current\Automated tests\EAW\extensions\targetFile.py</p>

<pre><code>import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..',  '..' , 'Common'     , 'extensions'))
import library
</code></pre>

<p>this resolved my problem thanks !</p>

python file import directory