How do I exit an application from a thread in python?
<p>Let's say I run a function in a thread that prints a number every 5 seconds, while the main application is running in the background: </p>

<pre><code>import threading

def print_num(x):
    x += 1
    print(x)
    threading.Timer(5.0, print_num, [x]).start()

print_num(0)
main()
</code></pre>

<p>How do I close the main application and the thread itself if the number exceeds 100?</p>