Custom Exception handling in Python 2.6.5 and importing modules
<p>I had one script with custom exception classes in the form of:</p>

<pre><code>class DirectionError(Exception):
    pass
</code></pre>

<p>I had my functions in the same script in the form of:</p>

<pre><code>def func1(x):
    if x == 1:
        raise DirectionError
</code></pre>

<p>I put my function calls into a try/except/except block in the form of:</p>

<pre><code>try:
    func1(2)
except DirectionError:
    logging.debug("Custom error message")
    sys.exit()
except:
    logging.debug(traceback.format_exc())
</code></pre>

<p>I subsequently moved the functions into a seperate mytools.py file.  I import the mytools.py file into my main python script.</p>

<p>I moved the custom exception classes into the mytools.py file but exception is not reaching the main python script.</p>

<p>How do I get those functions in the mytools.py file to send the exception back to the try/except block in my main python script?</p>

<p>Thanks.</p>
