ar1
December 28, 2019, 7:47am
1
I have a module named globals_ in my current application which is referenced by some forms and it works as intended when I “import globals_” in these forms
I created a new form and included “import globals_” and I receive the import error message.
what am I missing?
Thanks
Have you recently upgraded to Python 3?
Not that I am an expert but I have read that python 3 requires an explicit import.
https://anvil.works/forum/t/organising-big-apps-and-python-3-in-the-browser/3883?u=rickhurlbatt
2 Likes
ar1
December 28, 2019, 12:49pm
3
yes- this was after the upgrade to 3. I have reverted back to 2 and its working.
Thanks
1 Like
Wach
May 26, 2020, 8:28pm
4
Please is there a way this module importation can be done with python 3?
Wach
May 26, 2020, 8:48pm
6
I looked through the content of this and I tried it out and it didn’t work.
Can you send a screen shot of the navigation panel or a share link to your app or some code snippets?
You need to add some code like
from ..Globals_ import Globals_
I am not sure about whether the _ will cause issues though. I will test now.
Also try typing from
and then pressing tab to bring up the auto completer to select the right import statement
See this post as I think it is related or may be the same issue:
I’m truly trying to really understand this but then, let me explain what I wish to do.
The navigation module was created to work with the HomeForm and perform the functions as seen.
I want a peculiar scenario whereby after a user adds measurement, it goes refreshes and goes back to the home form.
The link taught how to import modules but it didn’t tell how to import a form with a child being a module.
I will look up this circular imports though.
2 Likes