How to Solve NameError: name 'Union' is not defined -- typing

Solution: Import the 'Union' module

# Add the following line to the top of your code
from typing import Union

 

For more information:
typing Union