title: Python's os.chdir function isn't working
body: <p>I'm having some very mysterious behavior with a script that fails to run.  Obviously the script below is trivial and does nothing, but it's reproducing behavior in a real script.  Here's the code inside a file called <code>test.py</code>.</p>
  
  <pre><code>import os
  os.chdir('/home/jacob/twcSite')
  import app
  </code></pre>
  
  <p><code>app</code> is located in <code>'home/jacob/twcSite'</code>, which is a different directory than the current one, containing <code>test.py</code>.  If I type <code>python test.py</code> at the command line, I get <code>ImportError: No module named app</code>.  However, if I simply type <code>python</code> to launch the interactive interpreter and copy-paste the exact same three commands, then it works just fine without an import error.</p>
  
  <p>What could possibly be causing this error?  It's the same version of python.  The exact same lines of code.  Why do I get different behavior in either case?  Just to give more details, if you print the output to <code>os.getcwd()</code> before and after calling <code>os.chdir</code> it does indeed claim to have changed to the right directory (though clearly that's not the case).  I'm running Ubuntu 14.04, Python version 2.7.6.</p>