Dynamically updating the PYTHONPATH prevents .pyc update
<p>To allow myself to have a clear filestructure in my project i am using the following code snippet to dynamically add the project main folder to the PYTHONPATH and therefore assure that I can import files even from above a files location.</p>

<pre class="lang-py prettyprint-override"><code>import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "."))
</code></pre>

<p>Since I did this, when I start my main file, changes to the modules aren't recognized anymore until i manually delete any .pyc files. Thus I assume this for some reason prevented python from checking if the pyc files are up to date. Can I overcome this issue in any way?</p>

<p>You could try to make python not write those *.pyc files.</p>

<p><a href="http://stackoverflow.com/questions/154443/how-to-avoid-pyc-files">How to avoid .pyc files?</a></p>

<p>For large projects this would matter slightly from a performance perspective. It's possible that you don't care about that, and then you can just not create the pyc files.</p>

python pythonpath pyc