#!/usr/bin/env python import sys import time import threading class T(threading.Thread): def run(self): while True: time.sleep(1) print('hihi') print('exiting from thread...') def main(): t = T() print(t.isDaemon()) t.start() time.sleep(2) print('exit...') sys.exit() main()