Possible documentation issue

In the app that we clone when reading about using Globals to communicate between forms, the example app shows an import of “from . import Globals”

However, I think it needs to be “from …import Globals”

Could be wrong but, the autocomplete helper helped me find this.

2 Likes

I’ve noticed that even between forms in the same package, the number of dots needed can vary. I’ve gotten out of the habit of copying and pasting those imports between forms and always let the autocomplete find them now.

4 Likes

Hi @dconnell,

You’re right it should be from .. import Globals. The Globals example app was created a long time ago and was running legacy code. I’ve updated the app so anyone cloning it now gets the correct code.

You’re also right that the best way to avoid issues like this in your own app is to use autocomplete.

Quick edit:
The legacy code existed in the Global example app because the app was created before we introduced packages. If anyone is interested in reading more, we have a how-to guide which explains the difference and how to convert any legacy Anvil apps to use packages.