It may or may not be an error.
If you have import datetime then you need datetime.datetime.now(), but if you have from datetime import datetime then datetime.now() will work. That’s because it’s the datetime class that has the method .now(); the datetime module doesn’t have a now() function.
It could be a little confusing that the module is called datetime and that it has an identically-named class called datetime rather than, say, DateTime.