NameError: global name 'datetime' is not defined

That’s correct. The tutorial indicates to include the get_marketing_data function within the python script used to access the anvil server. If I include it in the server module it runs with no problems. Here’s the code in the script:

import anvil.server
anvil.server.connect('ACCESS_KEY')

@anvil.server.callable
def get_marketing_data():
    # access data on your local machine and return as a Python list
    return [{'strategy':'Strategy A', 'count':200},
            {'strategy':'Strategy B', 'count':185},
            {'strategy':'Strategy C', 'count':175}]
            
anvil.server.wait_forever()