Open ivaniliash opened 4 months ago
Thanks @ivaniliash - would adding a main_module_filename: str = "streamlit_app.py"
as a parameter to the switch_page
function solve your issue?
@arnaudmiribel I simply replaced line 22 with pages = get_pages(os.path.basename(__main__.__file__))
. Should work if its always the main script we are looking for.
Edit: Probably os.path.basename
is not needed though, but not sure
Description
The main script path is hardcoded in
switch_page_button/__init__.py
It will always lead to a
RerunException
if the main script is renamed. Page switching still works, however the expection raising can lead to problems in error handling. For example it will not work if theswitch_page
method is part of a try/except block.I already have a proposal to fix this and I'd love to contribute, however I'm not sure how to create a pull request 😄
Reproduction steps
Version of streamlit
1.30.0
Version of streamlit-extras
0.4.0