NameError: global name 'datetime' is not defined

perhaps you can post your clone link. See this link for instructions if that sentence didn’t make sense.

How to ask a good question

If you don’t get an import error then we know that datetime was imported correctly so it is there.

Off the top of my head make sure your importing datetime into each module you use it in.
Check the line of code that’s causing the error and make sure the import statements exist in that specific module.