title: Python - Calling a script from another script and handling exceptions from the second one
body: <p>So I have this script, a python script (call it AAA.py) and it calls a method in another python script (call it BBB.py).
  Now this method in BBB.py throws and handles a KeyError exception but when I run AAA.py it raises the exception to my console as if it wasn't handled... and I don't understand why.
  Could someone explain this to me please?</p>
  
  <p>Yes I've read the documentation on exceptions in python.</p>
  
  <p>Here is the Try/Except:</p>
  
  <pre><code>try:
      if network['network'] == vlans_dict[network['netName']]['netaddr']:
          self.test_pass('Network address matches VLAN Router: ' + str(network['network']))
      else:
          self.test_fail('Network address does not match VLAN Router: ' + network['netName'],
                          'Expected: ' + str(vlans_dict[network['netName']]['netaddr']),
                          'Actual: ' + str(network['network']))
  except KeyError:
      self.test_fail("No subnet obtained for " + network['netName'] + " from VLAN info")
  </code></pre>
  
  <p>Honestly it would be ridiculous to add the rest of the code...</p>
  
  <p>So just to add a bit more to this... if I run the second script directly on it's own it handles the exception as gracefully as intended.</p>
  
  <p>Regards,
  J</p>