title: catch exception in python script which calls another script
body: <p>I am running python script from another python file. is there a way I can know if an eception occurred in the second script?</p>
  
  <p>EX: script1.py calls script2.py
      python script2. py -arguments
  How can script1 know if an exception occurred in script2?</p>
  
  <p>run.py</p>
  
  <pre><code>import subprocess
  </code></pre>
  
  <h2>    subprocess.call("python test.py -t hi", shell=True)</h2>
  
  <p>test.py</p>
  
  <pre><code>import argparse
  print "testing exception"
  
  parser = argparse.ArgumentParser(description='parser')
  parser.add_argument('-t', "--test")
  
  args = parser.parse_args()
  
  print args.test
  raise Exception("this is an exception")
  </code></pre>
  
  <p>Thanks</p>