I don’t think the author is going to refactor his code & re-shoot his videos. To me, he seems to be saying: “It works the way I wrote it!” and indeed it does. He pointed out that anvil.works changed how they do things just one month after he published his course…
Although that must have been a tad irksome, his course is not going to benefit anyone now. Shame that! I liked it until I didn’t.
I might buy it, if he fixes it & republishes it as a paying rather than a free course.
A thought - Anvil still supports anvil apps in the old style… i.e. without package forms… all you have to do is find someone who’s been here long enough with an app in the old style that they didn’t get round to converting.
This way you can follow along with the video tutorials and have the same syntax.
Just don’t click enable packages/upgrade to python 3…
and if you do by accident you can always revert it using the version history…
In case it helps: you can convert any Form to be a Module Form if you want to… see my post here:
This is gently discouraged by the fact that we’ve put it behind an ‘advanced’ menu… it’s generally better that ‘every Form is a package’ to save needing to think about it. But for legacy things such as this, the conversion option is there!
Thanks guys. I will do that after I’ve gone through your tutorials and encultured myself into the platform. I’m ploughing through them now and I must say I am really, really impressed!
Actually, I did get the authors app from his github and ran it on anvil and it worked flawlessly, using the old ways…
When I have the skills I will do exactly as you suggest
To be fair, I haven’t tried. I’ve been working with Anvil for a couple of years, now, and so it didn’t seem like I was likely to learn anything from it – especially given the reported problems. That, and I have my own bread-and-butter app to work on.
That said, I am more than sympathetic. I remember needing tutorials, at many points in my career. And there are professional educators in my family, so I have a personal interest in everyone maintaining the quality of educational materials, as much as practical.
And in the button I call the navigation go_home this way:
Fitnessd.navigation.go_home()
The “import Fitnessd.PackageModulus.navigation” did not work for me. Not sure if that is due to continued changes in the Anvil code or if it relates to the circular import problem manifesting differently for different people??
Thank you so much! I spent much time trying to figure this out. It is unfortunate that some training material promoted by anvil contains this issue. On the plus side its encouraging to see that the forum contains the solution. Many thanks for sharing.
Another thanks for this forum. I join the ranks of the frustrated, but thankfully not 24 hours, lol.
I ended up just importing the navigation within the button click (@meredydd thanks) because my app name has spaces in it so something like “import my app with spaces.navigation” does not work. Fortunately, most of my navigation is done through the menu on the left, so I only need this in a few manageable places.
Down the line, I might think about renaming my app and removing the spaces.
Thank you so much I like your approach better than placing the import in the function - placing the import in the function has never been taught to me. I’ve always been shown that imports are always to be placed first up above everything else being code from my understanding - but I do understand why @meredydd mentioned placing it in the function itself. Thank you again and Thank you All for contributing to this Forum. as my journey continues learning Anvil, sometimes I wonder if I should go back to Django
I also do wonder if these two ways of implementing the task work which one is the True Pythonic and correct way? hmm “loaded question perhaps”
That’s true. And the pep8 style guide agrees with this statement.
That said, there are examples of imports within functions in the cpython source code e.g.
Thank you @stucork, because of your involvement like this and all the other contributors to this forum it’s just amazing and truly appreciative. Thank you for that piece of information it really helps me as I continue to grasp Python & Anvil thank you again.
@support1: I too had problems with this circulair import thing which deviates from the TalkPython course when I started with Anvil. However the solution of Meredydd works fine, so I now import my navigation module local in the function. I still use the set-up of the course for my own apps, because this structure for navigation and caching is good. My problem with Django was that I had to study a lot of blogs and manuals to get anything done that was more complex than showing just a simple form. I’m very glad with the Anvil documentation which is very compact and to the point. And if I have question and post it on the forum it’s usually answered within half an hour, even at midnight !
Thank you, I see we share similar thoughts when it comes to the Django even though htmlx is calling me I really feel anvil is solid and can take me a long way hopefully, thanks again