I am trying to get the send_login_form button to cause questionForm to be displayed in Homeform,content_panel.
I can’t figure out why I keep getting this error message.
Any help will be greatly appreciated.
This is the first time I am using the clone link so if I’ve done something wrong please let me know.
https://anvil.works/build#clone:GM4JZMBNTIHXNHB5=4DXG6QP27OJ4LCPJ2CSAHSUV
Thanks
Wayne
Your error message is
NameError: name 'navigation' is not defined
at Homeform.loginForm, line 22
That’s happening because you have not imported the navigation module. You have an incorrect import commented out.
When trying to work out what the import should be, trust the autocompleter. In your loginForm, start typing from navigation
and the autocompleter will tell you what your legal import options are. Don’t try to guess the number of dots needed, let Anvil tell you.
Once you import navigation properly, you’ll start to get a number of other errors that are related to circular imports. If HomeForm imports navigation and navigation imports LoginForm and HomeForm, and LoginForm imports navigation, eventually Python detects that you’ve got a circular set of imports and throws the sort of error you’re seeing.
There are a variety of ways to solve the issue. The quickest way is to move your form imports in navigation into the functions that use them. For example, in navigation:
def go_home():
from homeForm1 import homeForm1
form = get_form()
form.load_component(homeForm1())
That prevents the import from happening when the modules are loaded, and keeps the circular import bug from happening.
Thanks for the response,Ive been at it,
Is this the circular error you were refering to.
AttributeError: module ‘Career_for_U.Homeform.loginForm’ has no attribute ‘loginForm’ at [Homeform.navigation, line 8](javascript:void(0)) called from [Homeform.loginForm, line 9](javascript:void(0)) called from [Homeform, line 10](javascript:void(0))
I have altered the navigation module as you suggested but am still getting the error,
Sorry to be a pest but am I still not understanding what you suggest I do.
https://anvil.works/build#clone:GM4JZMBNTIHXNHB5=4DXG6QP27OJ4LCPJ2CSAHSUV
You still have the imports at the top of your navigation module. They’re what’s causing the circular import issue. You have to remove those, and put them into the appropriate functions.
1 Like
got it!
thank you so much
1 Like