Thank you very much for the quick response! I think I understand a bit better now.
So just to recap: Any object that is instantiated outside of app.py (like nav_state = param.rx(“Home”) in the original code) and then simply referenced by app.py, will not be destroyed and recreated. Every object storing data for the app needs to be instantiated from app.py to avoid problems.
Trying to understand your second paragraph - does the following represent the approach you prefer?
SomeScreen.py
SomeScreen(Viewer):
def panel(self):
return pn.Column(…)
App.py
def some_screen():
return SomeScreen()
ROUTES = {
“1”: some_screen
}
pn.serve(ROUTES)
In the documentation on deploying panel apps it says it is preferred to use panel serve app.py
instead of pn.serve()
. Knowing this, would approach 3 in the link you provided be the best for our use-case (HomeScreen as a starting screen; from it, the user can navigate to many different screens, each allowing navigation to different screens again), since it’s using panel serve
and not pn.serve()
? I am not a computer scientist, nor am I experienced with hosting web apps or websites, so please forgive my ignorance. Since you, if I understand correctly, prefer pn.serve() and are likely to have experience using it - is there any downside to using it when deploying the app compared to panel serve
like the documentation suggests?