Update: It’s now OK to import anvil.designer
on the server, in Python 3.10 (Full Python 3 is coming shortly ). This means you can include that import in your Modules as well as your Forms, if that suits you.
(Of course, you can’t actually use that module on the server, for obvious reasons! But this should avoid anything blowing up :-D)