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

Solution: Import the 'import_module' module

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

 

For more information:
importlib import_module