Pass variables between HTML files and streamlit

I’m trying to render HTML files from streamlit using st.makdown and unsafe_allow_html=True. But the same time, I want to be able to pass variables between streamlit and HTML.

Can something like jinja2 templates be used for this purpose ? If yes, how ?

Here is an example of the code:

Import streamline as st

St.set_page_config(layout='wide')

With open('navbar.html') as navbar:
   St.markdown(f'{navbar.read()}', unsafe_allow_html=True)


With open('content.html') as body:
   St.markdown(f'{body.read()}', unsafe_allow_html=True)

With open('footer.html') as footer:
   St.markdown(f'footer.read()', unsafe_allow_html=True)