title: ipython run without destroying global variables defined in the target file
body: <p>I want to define some globals in some number crunching work I am doing, I am incrementally writing the script and don't want previous result to keep being loaded/recalculated. One approach is to split out mature code into a separate file and only <code>python run</code> interactively new code. However I just want to do it in a single file for speed of development.  </p>
  
  <p>I was under the assumption that a global defined in a file would persist between invocations of <code>run</code>, but they do not. </p>
  
  <p>So my script has the following chunk if code : </p>
  
  <pre><code>if globals().has_key('all_post_freq') != True:
      print "creating all post freq var"
      global all_post_freq
      all_post_freq = all_post_freq_("pickle/all_post_freq.pickle")
  </code></pre>
  
  <p>How do I retain all_post_freq between invocations of <code>ipython run</code></p>
  
  <p><strong>edit</strong> </p>
  
  <p>ok I have split stuff up into files, but I know there must be a way of doing what I need to do :D </p>