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

Solution: Import the '_get_sourcefile' module

# Add the following line to the top of your code
from importlib._bootstrap import _get_sourcefile

 

For more information:
importlib _get_sourcefile