How to Solve NameError: name 'annotations' is not defined -- __future__

Solution: Import the 'annotations' module

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

from __future__ import annotations

 

For more information:
Python __future__ annotations