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

Solution: Import the 'machinery' module

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

 

For more information:
importlib machinery