Newcomer: AttributeError in the Tutorial

Hi,
I’m very new to Anvil. I’m learning it by following your tutorials (Data Dashboard) but I’m struggling with an error that I was unable to find listed anywhere. When I try to define

from anvil import *
import anvil.server
[…]
@anvil.server.callable
def get_weather_data(latitude, longitude):
[…]

and I run it, I get
AttributeError: module ‘anvil.server’ has no attribute ‘callable’

I’ve been reading and googling and searching the Q&A but I’ve got no cues of my error; it should be something stupid but … can you provide any hint?
Thanks

Welcome to the forum.

That decoration is only available in server modules. Are you by any chance doing that in a form?

I ask because :

from anvil import *

is automatically added to form code and not server code.

1 Like

Hi!
Thanks for your reply.

I think I’m in a form (see image below), but I’m following the tutorial https://anvil.works/learn/tutorials/dashboard/chapter-4 and so far everything was expected to work this way … Am I missing something else?
Thanks,
Massimo

Hi,
I’ve got it; I did not figure out where to put the code … I told you it was a stupid thing for sure!
Thanks

We’ve all been there :slight_smile:

Glad you got it working.

1 Like