Start two threads in same time

koranthala koranthala at
Fri Jan 16 15:46:54 CET 2009

On Jan 16, 7:36 pm, vedrandeko... at wrote:
> Hello,
> Does anybody know how can I start two threads in same time?
> Regards,
> John

Use threading module.
Creating a new thread is as easy as --
import threading

class ThreadedClass(threading.Thread):
    def __init__(self):

    def run(self):
         **Do whatever you want do in the new thread here**

threaded_obj = ThreadedClass()
threaded_obj.setDaemon(True)  # If you want a daemon thread
threaded_obj.start() # Start the new thread

%%%%Do whatever you want to do in main thread here%%%

threaded_obj.join() #Close the new thread by joining it with the main


The following document might be of help:

More information about the Python-list mailing list