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

Solution: Import the 'functools' module

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

 

For more information:
Python functools