How to Solve NameError: name 'ImageGrab' is not defined -- PIL
Solution: Import the 'ImageGrab' module
To Solve the error, add the following line to the top of your code.
from PIL import ImageGrab
For more information:
Python PIL ImageGrab