St_pages issue when app is running

I have the following bug,

When I have an instance of my streamlit app open, and I go to the terminal and terminate it abnormally (CTRL+C) and I relaunch it, if any page is open in the browser while restarting, then show_pages() fails to rename my pages and hide the ones I want.

In order for it to work, I must close all open windows in the browser, and only then restart the app, in that case, pages get renamed correctly and main page is hidden successfully.

I assumed it would be something related with the current directory and show_pages not finding my pages, but printing the current directory with the os library showed that the directory is the same in both cases. I have also modified the paths of the pages to be as “absolute” as possible, with “/opt/app/src/pages/blabla.py”, but it still fails to rename them. Note that there is no error like “The pages were not found”, they just dont get renamed and the hide page simply doesnt work…

Can you share a simplified example which demonstrates this issue? Feel free to look at the example apps in the st_pages repo to see how they are set up.

I had a similar issue that I was able to resolve by renaming the “pages” folder to something else, i.e. “_pages”.

It appears that Streamlit’s innate pages functionality takes precedence over st_pages in the newer versions of Streamlit for some reason. Hope this helps.