def thread_test(o): for i in range(5): o.write("Hi from thread %d\n" % (win32api.GetCurrentThreadId())) win32api.Sleep(100)