I think the problem you’re facing is related to this from the docs:
Persistent Server Modules
Each server function call is executed in a new Python interpreter, meaning that global variables won’t persist between server function calls.
Enabling Persistent Server Modules by checking ‘Keep server running’ allows the same interpreter to be used for multiple server function calls.
Persistent Server Modules are available on the Business Plan and above.
Do you send db to the client in some form?
client global variables might be the way to go…
App Structure:
- module: _globals
- form: Form1
- form: Form2
_globals
fig_list = None
employee_groups = None
Form1
from . import _globals
class Form1(Form1Template):
def __init__(self, **properties):
if _globals.employee_groups is None:
_globals.employee_groups, _globals.fig_list = anvil.server.call('get_groups_and_figs')
self.employee_groups = _globals.employee_groups
Form2
from . import _globals
class Form2(Form2Template):
def __init__(self, **properties):
if _globals.fig_list is None:
_globals.employee_groups, _globals.fig_list = anvil.server.call('get_groups_and_figs')
self.fig_list = _globals.fig_list