title: Handle Exception When Running Python Script From Another Python Script
body: <p>I am running a python script from another python script and I am wondering how I can catch exceptions from the parent python script.</p>
  
  <p>My parent python script calls another python script n amount of times. Eventually that called script will exit with a 'ValueError' exception. I'm wondering if there is a way for my parent python script to notice this and then stop executing.</p>
  
  <p>Here is the base code as-is:</p>
  
  <pre class="lang-py prettyprint-override"><code>import os
  
  os.system('python other_script.py')
  </code></pre>
  
  <p>I have tried things such as this to no avail:</p>
  
  <pre class="lang-py prettyprint-override"><code>import os
  
  try:
     os.system('python other_script.py')
  except ValueError:
     print("Caught ValueError!")
     exit()
  </code></pre>
  
  <p>and</p>
  
  <pre class="lang-py prettyprint-override"><code>import os
  
  try:
     os.system('python other_script.py')
  except:
     print("Caught Generic Exception!")
     exit()
  </code></pre>