When you click the second button, the first one reverts back to False, so the fig is not created. You can try keeping the figure in the st.session_state so it persists.
Check this other post: How to do nested button and print both button outputs? - #2 by mathcatsand