Hey,
I created a module which happens to be under my home page form and I wish to import it in another form but it keeps showing me the error below.
Please, I need help on this. I’m currently using python 3.
Thanks in advance.
Do you have a clone link you can share? Click the icon and follow the instructions.
Oh BTW, please have a look at the documentation. Once you have understood that, let us know if you still need help.
https://anvil.works/docs/structuring-your-app/how-to-import-things
I took a quick look and to my eyes it seems like you are getting bit by a circular import.
Your home page is importing navigation
and navigation
is importing add_measurement
, but add_measurement
is also trying to import navigation
before navigation
is fully loaded.
You could refactor things in various ways to avoid this. For example, in navigation
it would probably work to move your specific import statements inside of the functions that need them. I think that would work.
There is other information on circular imports on the forum and online, with helpful suggestions and more information.
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.
do check out this forum post which is related to the issue
Your solution here worked for me.
It also eliminated the need for circular import.
Thank you.