Start() vs run() for threads in Python?

You are correct in that run() does not spawn a separate thread. It runs the thread function in the context of the current thread.

It is not clear to me what you are trying to achieve by calling start() in a loop.

  • If you want your thread to repeatedly do something, then move the loop into the thread function.
  • If you want multiple threads, then create multiple Thread objects (and call start() once on each of them).

Finally, to pass arguments to a thread, pass args and kwargs to the Thread constructor.

Leave a Comment

tech