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

Solution: Import the 'importlib' module

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

 

For more information:
Python importlib