AttributeError: module 'anvil.server' has no attribute 'route'

Can any one please advise why I could be seeing the error “AttributeError: module ‘anvil.server’ has no attribute ‘route’”

Tried a very basic example as described here Serve anything, anywhere on your domain, with @anvil.server.route()

import anvil.server
....
@anvil.server.route("/hello")
  def my_page(**p):

(nb. project set to use Python 3.10beta)

I would be grateful is someone could please assist on whether there is something I could be doing fundamentally wrong, or whether it is because this feature is not yet publically available?

Thank you

Is this in Server Code or Client Code?

Last I checked, this runs only server-side.

2 Likes

Just confirming @p.colbert’s observation:
Using @anvil.server.route within a form’s code will generate the error that you reported.

Thank you for confirming, yes was in main form.