# SuperFastPython.com
# example of extending the Thread class
from time import sleep
from threading import Thread
# custom thread class
class CustomThread(Thread):
def __init__(self):
Thread.__init__(self, name="Name_of_your_thread")
# override the run function
def run(self):
# block for a moment
sleep(1)
# display a message
print('This is coming from another thread')
# create the thread
thread = CustomThread()
# start the thread --> run() function
thread.start()
# wait for the thread to finish
print('Waiting for the thread to finish')
thread.join()