Streamlit folium, AttributeError: 'TemplateModule' object has no attribute 'script'


Before i get started, i love streamlit.
I’m definietly not an experienced streamlitter(?) but it has greatly improved my workflow, so many thanks to all of you for creating this awesome library! :slight_smile:

What I’m trying to do at the moment is to visualise popups as explained in
Quickstart — Folium 0.12.1 documentation and the example “Vincent/Vega and Altair/VegaLite Markers”
I’ve also looked at this stackexchange question
python - Unable to insert altair visualisation as popup in folium map - Stack Overflow

However the program throws an error message when i get to the line
AttributeError: ‘TemplateModule’ object has no attribute ‘script’

So I think i might be managing to create the popups and assigning them to the markers correctly(?)

I’m also writing the map before sending it to st_folium and it gives me a bunch of text I can’t really make sense of.
not all but some of it:
L_NO_TOUCH = false;
L_DISABLE_3D = false;

<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
<script src=";&gt;&lt;/script&gt;
<script src=";&gt;&lt;/script&gt;
<script src=";&gt;&lt;/script&gt;
<script src=";&gt;&lt;/script&gt;
<link rel="stylesheet" href=";/&gt;
<link rel="stylesheet" href=";/&gt;
<link rel="stylesheet" href=";/&gt;
<link rel="stylesheet" href=";/&gt;
<link rel="stylesheet" href=";/&gt;
<link rel="stylesheet" href=";/&gt;

import streamlit_folium
import altair as alt
import folium 
import pandas as pd

map_geo = folium.Map(location=[57.46901, 14], zoom_start=13, width=1200)
with st.sidebar:
 for key in get_data():
    df_to_plot = pd.DataFrame()
    x = get_data()[key]['X'][0]
    y = get_data()[key]['Y'][0]
    df_to_plot['E-modul']= get_data()[key]['E-modul']
    df_to_plot['Djup mum']= get_data()[key]['Djup mum']

    chart = alt.Chart(df_to_plot).mark_line().encode(
            y='Djup mum',

    popup = folium.Popup(max_width=650)

    folium.Vega(chart, height=350, width=650).add_to(popup)

    folium.features.VegaLite(chart, height=350, width=650).add_to(popup)

    folium.Marker([x,y], popup=popup).add_to(map_geo)