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

Solution: Import the 'fnmatch' module

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

 

For more information:
Python fnmatch