title: How can I resume/reload a Python (IDLE) [2.7] shell where it left off?
body: <p>In Python 2.7, I am debugging an imported module, using an extensive standing environment in the IDLE shell. I wish to recreate that environment automatically (versus manually typing line-by-line) to ease debugging each time I <code>Check Module</code> (triggering an automatic restart in the shell and losing the current state). Is there a way to save shell state, or create a script to re-open the shell [as it was] with a number of commands already run?</p>
  
  <p>This is different from saving a file or script - I wish to restore the shell to the same state it was in previously. For example, if I've executed <code>import os, numpy</code>, and assigned several variables <code>a = 'foo'</code>, <code>bar = 229</code>, I want to restore the shell to the same state of having already imported os, numpy, and assigned <code>a</code> and <code>bar</code>.</p>
  
  <p>To address comments: Opening a file opens the file in idle; not what I want. Saving a script is fine, but does not restore the state of the shell window.</p>