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

Solution: Import the 'pathlib' module

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

 

For more information:
Python pathlib