Run streamlit file confused

when i run streamlit file demo1.py, but the browser gives me wrong content running, it feels like my demo2.py’s content.
demo1.py code shows as following:


demo2.py code shows, the browser shows when running demo1.py

i feel very confused, why i run demo1, but the first line code didn’t work, such as st.write('method1') didn’t show up. please anyone can tell me what happened?


may I ask how you organized your folders? streamlit support multi - pages, so if you put everything in root folder and not using correct command of `streamlit run demo1.py’ , it could cause problems as you described.


Translated to chn
你文件夹怎么组织的, streamlit 支持多页面的, 根目录应该放你的demo1.py, 然后新建文件夹命名为"pages" 存放其他页面

运行命令应该是在根目录 `streamlit run demo1.py’

Could you post in english?

1 Like

Could you post a text code and not a code in the image.

Thanks for your answer, i found that in my demo1.py quote another file mapping.py, and the browser shows content is the mapping.py’s code, so i guess the reason is quoting mapping.py. so i tried to delete quoting mapping.py file, and it solved. Thank you so much.

Thanks for your answer, i found that in my demo1.py quote another file mapping.py, and the browser shows content is the mapping.py’s code, so i guess the reason is quoting mapping.py. so i tried to delete quoting mapping.py file, and it solved. Thank you so much.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.