from threading import Thread def worker(): while 1: pass thread = Thread(target=worker, name="daemon-thread") thread.setDaemon(1) thread.start()