St.button inside html generated by markdown

is there possible to call a python function inside a html generated markdown?

I have something like this:

def img_to_markdown(img_path, inherit=""):
    def img_to_bytes(path):
        return base64.b64encode(Path(path).read_bytes()).decode()

    class_inherit = f"class='{inherit}'" if inherit else ""
    img_html = (
        f"""<img src='data:image/png;base64,{img_to_bytes(img_path)}' {class_inherit}>""")
    return img_html

class Table():
    def btn_download_button(self, raw: str) -> str:
        if raw:
            return f"""<a href='{raw}' download='{raw}' class='centered-image-button'>
                       {img_to_markdown("./images/download.png", inherit='enabled')}
            return f"""<div class='centered-image-button'>
                        {img_to_markdown("./images/download.png", inherit='disabled')}

    def btn_delete(self, key):
        return f"""<div key={key} class='centered-image-button'>
                    {img_to_markdown("./images/delete.png", inherit='enabled')}

    def render(self, documents):
        table_data = [[document.field1,
                      for document in documents]

        table_rows = [f"<tr>{''.join([f'<td>{d}</td>' for d in document])}</tr>" for document in table_data]
        if not table_rows:
            table_rows = ["<tr></tr>"]
            st.warning("No files found.")
        table = f"""<table> 
        st.markdown(table, unsafe_allow_html=True)

And i want to update the btn_delete in a way to call a python function, something like that:

def delete(key):

def btn_delete(self, key):
        return st.button(label=f"Delete {key}", on_click=delete, args=key)

In this way the buttons are rendered but not inside the table. Is there a way to add the function to the html tag or to render the st.button inside the table ?

Hope to be clear

Thanks a lot!

Did anyone find a solution to this? I have created cards to showcase data and I want to include a button in my card to be able to show the data frame when the users click.