title: How to temporarily modify sys.path in Python?
body: <p>In one of my testing scripts in Python I use this pattern several times:</p>
  
  <pre><code>sys.path.insert(0, "somedir")
  mod =  __import__(mymod)
  sys.path.pop(0)
  </code></pre>
  
  <p>Is there a more concise way to temporarily modify the search path?</p>