Button inside if statement

hi guys,

I have a problem, when I try to move to the next command
After clicking next button inside if statement , It keeps showing me the previous part.
And only after clicking again on the next button it does not show the previous part

I tried many options without success (on_click,callback and more).
The goal is to move between stages and display only that stage for each stage

Hi @Ido_Lapid , thanks for posting. Can you possibly give the code instead of an image?

Also, the problem is that you’re trying to reset the counter when you click the st.button(“back”)?

This is a general example of the idea.

The goal is to move from one block of code to the next by clicking the button alone. In practice, this always requires two clicks, which hurts user engagement.

Of course this is only when it is inside if statement or in nested button.

I honestly don’t quite understand what you’re trying to get at. Can you give me some code that reproduces your problem that I can copy and paste and then tell me expected behavior?