Example of the thread running on exit
<pre><code>
import threading
import time
import sys
class Worker():
def PrintSomething(self):
while True:
print "something"
time.sleep(1)
if name=="main":
worker=Worker()
wthread=threading.Thread(target=worker.PrintSomething)
wthread.start()
sys.exit(0)
while True:
#input=raw_input("Your input?: ") #waits for user input and currently blocks 'worker' thread in Pythonista
time.sleep(1)
</code>
</pre>