.start() method activates and prompts a thread object to be run.
thread_object can only be run once. Otherwise, a
RuntimeError will be thrown.
import threadingdef do_this():print("Task done!")my_thread = threading.Thread(target=do_this)my_thread.start()
.start() method is invoked against
do_this(), will execute and the following will be printed:
Another example of the
.start() method being used is shown below:
Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.
Learn Python on Codecademy
Computer ScienceLooking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
Includes 6 Courses
With Professional Certification