title: Exit to command line in Python
body: <p>I have a script that I want to exit early under some condition:</p>
  
  <pre><code>if not "id" in dir():
       print "id not set, cannot continue"
       # exit here!
  # otherwise continue with the rest of the script...
  print "alright..."
  [ more code ]
  </code></pre>
  
  <p>I run this script using <code>execfile("foo.py")</code> from the Python interactive prompt and I would like the script to exit going back to interactive interpreter. How do I do this? If I use <code>sys.exit()</code>, the Python interpreter exits completely.</p>