Buttons inside a for loop


Be sure you read the main concept of streamlit especially on Data Flow.

You are using buttons, you need to read the button behavior as well.

Also read this forum guide and tips.

Regarding your code, button plus loop is going to be difficult to debug. When users press that button, streamlit will rerun the code from top to bottom. We need to rethink the flow of your code.

In this page there is a search button located at the top right.


Use this button to search for similar issues that you have. I saw a component/library/app that supports Q&A type app. It might give a hint to help with your issue.