I want a thread to run in parallel with the interactive interpreter. Simple: def do_work(): import time while 1: time.sleep (1) ... import threading threading.Thread (target=do_work()).start() But when I hit EOF, python waits until this thread is finished. How can I avoid this? I want python to terminate the thread and exit in this case. Thomas Heller