How to Solve NameError: name 'Key' is not defined -- pynput

Solution: Import the 'Key' module

To Solve the error, add the following line to the top of your code.

from pynput import Key

 

For more information:
Python pynput Key