import _thread as thread lock = thread.allocate_lock() lock.acquire() def child(): import threading print("child thread:", threading.current_thread()) lock.release() thread.start_new_thread(child, ()) lock.acquire() import threading print("main thread:", threading.current_thread())