How to Solve NameError: name 'time' is not defined -- datetime

Solution: Import the 'time' module

# Add the following line to the top of your code
from datetime import time

 

For more information:
datetime time