import threading import time import random def threadFun(): for i in range(10): print("ThreadFun - %d" %i) time.sleep(random.randrange(0,2)) class ThreadClass(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): for i in range(10): print("ThreadClass - %d" %i) time.sleep(random.randrange(0,2)) if __name__ == "__main__": tFunc = threading.Thread(target = threadFun) tCls = ThreadClass() tFunc.start() tCls.start() tFunc.join() tCls.join()