How to Solve NameError: name 'thread' is not defined

Solution: Import the 'thread' module

# Add the following line to the top of your code
import thread

 

For more information:
Python thread