title: Stop execution of a script called with execfile
body: <p>Is it possible to break the execution of a Python script called with the execfile function without using an if/else statement? I've tried <code>exit()</code>, but it doesn't allow <code>main.py</code> to finish. </p>
  
  <pre><code># main.py
  print "Main starting"
  execfile("script.py")
  print "This should print"
  
  # script.py
  print "Script starting"
  a = False
  
  if a == False:
      # Sanity checks. Script should break here
      # &lt;insert magic command&gt;    
  
  # I'd prefer not to put an "else" here and have to indent the rest of the code
  print "this should not print"
  # lots of lines below
  </code></pre>