title: %run Python function in IPython
body: <p>I'd like to run a function from IPython and load all of its data into the interactive namespace, just like how <code>%run filename.py</code> does it.  E.g., here's the file <code>scratch.py</code>:</p>
  
  <pre><code>def foo(x):
      a = x*2
  </code></pre>
  
  <p>In IPython, I'd like to run this function and be able to access the name <code>a</code>.  Is there a way to do this?</p>