Modules in Client Code

This is inside “Module1”

import anvil.server
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
def say_hello():
print(“Hello, world”)

where do I put this code inside Form1?

from .Form1 import Module1
Module1.say_hello()

I keep getting a “ModuleNotFoundError: No module named ‘Form1’”

When you do the import, starting with “from .” then let the autolist popup and give you the correct thing, I’d imagine it will be “from . import Module1”

1 Like

I figure it out.

Inside Form1 code:

import Module1
Module1.say_hello()