Problems importing modules

I am at the third day working on the imports, and I found (one of the reasons) why the imports in a server module work in Anvil and not in PyCharm.

Python and PyCharm seem to be happy after modifying the __init__.py like this:

# from this:
__path__ = [__path__[0] + "/server_code", __path__[0] + "/client_code"]

# to this:
__path__ = [__path__[0] + "/server_code", __path__[0] + "/client_code", __path__[0]]

Can I safely apply this change too all my apps?
Or do I risk to break something?

Sometimes Anvil changes the folder structure and applies automatic upgrades to the apps. Would this change break the apps at the next automatic change?

EDIT

I don’t have an answer yet, and, with the assumption that this change is not dangerous, I describe here how I’m setting up a few new apps now. This new setup does include this change.

1 Like