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

Solution: Import the 'imp' module

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

 

For more information:
Python imp