Please help, my class is erased from streamlit

Hi, I have a problem with streamlit, when I create an app with two classes and press a button the instance of the second class seems to get lost from streamlit, I know that in python it is not missing but on the streamlit server it deletes all the components related to that class, I share the example code:

import streamlit as st

class h:
def init(self,paren):
self.a = paren.main_form.write(“svsvs”)
self.b = paren.main_form.button(“svsr”)

class main:
main_form = None
def init(self):
self.main_form = st.beta_container()
self.tools = st.sidebar.beta_expander(“expander”)
tool = None
test = self.tools.button(“test”,key=“nnnn”,help=“vwfvwfvwvwv”)

    if test:
        self.tool = h(self)
    st.beta_expander("FAQ")

main()

In the slider there is a button, when it is pressed it creates a text and a button in the main interface, the problem resides when I press that second button, it deletes it along with the text. Please I need help inmediately :frowning: