title: How do I change directory in python so it remains after running the script?
body: <p>I'm trying to change the terminal directory through a python script. I've seen this <a href="https://stackoverflow.com/questions/431684/how-do-i-cd-in-python/431715" title="post">post</a> and others like it so I know about os.chdir, but it's not working the way I'd like. os.chdir appears to change the directory, but only for the python script. For instance I have this code.</p>
  
  <pre><code>#! /usr/bin/env python
  import os
  
  os.chdir("/home/chekid/work2/")
  print os.getcwd()
  </code></pre>
  
  <p>Unfortunately after running I'm still in the directory of the python script (e.g. /home/chekid) rather than the directory I want to be in. See below.</p>
  
  <pre><code>gandalf(pts/42):~&gt; pwd
  /home/chekid
  
  gandalf(pts/42):~&gt; ./changedirectory.py
  /home/chekid/work2
  
  gandalf(pts/42):~&gt; pwd
  /home/chekid
  </code></pre>
  
  <p>Any thoughts on what I should do?</p>
  
  <p><em>Edit</em>: Looks like what I'm trying to do doesn't exist in 'normal' python. I did find a work around, although it doesn't look so elegant to me.</p>
  
  <pre><code> cd `./changedirectory.py`
  </code></pre>