title: Using %run in jupyter notebook without affecting interactive namespace
body: <p>I am trying to run a python script in a jupyter notebook without the variables in the script being passed to my interactive namespace after the script has been called.</p>
  
  <p><strong>An example below:</strong></p>
  
  <p>myscript.py:</p>
  
  <pre><code>var1 = 10
  </code></pre>
  
  <p>My notebook:</p>
  
  <pre><code>var1 = 9
  %run myscript.py
  print(var1)
  </code></pre>
  
  <p>I want the printed answer to be 9 not 10. I have also tried running <code>%run -p myscript.py</code> as stated in the <a href="http://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-run" rel="nofollow noreferrer">documentation</a> but seem to get the same result.</p>