Can you use buttons inside of expanders?

I’d like to put a button inside of an expander. Is this possible? The code below writes “Test” inside the expander but the button is drawn outside of it.

with st.sidebar.beta_expander(“Adjust settings”):

st.write("Test")

if st.sidebar.button("Reset Draft"):

    results_df = results_df[df.round == 0]

    results_df.to_csv('draft_results.csv')

You can do that by assigning the beta_expander to a variable and then call the button from that:

expander =  st.sidebar.beta_expander("Adjust settings")
expander.write("Test")
if expander.button("Reset Draft"):
    st.write('Draft resetted')

That’s perfect, thank you!