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() = st.sidebar.beta_expander(“expander”)
tool = None
test =“test”,key=“nnnn”,help=“vwfvwfvwvwv”)

    if test:
        self.tool = h(self)


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: