Using Polars filter stops dashboard from Updating

I’m running the code below in jupyter notebook. I took some code that displays a Gaussian filter and has widgets to control the shape of the curve. However, as soon as I use a Polars filter to get some data, the interactivity breaks and the graph stops updating. If I just comment out the one line in the return of func_wrap, and replace it with something else the interactivity works fine! Even though the func_wrap function has nothing to do with the Gaussian graph, it somehow breaks the dashboard. Why is this happening? What should I do?

time_slider = pn.widgets.FloatSlider(name=“time”, start=-5, end=5, step=0.1, value=0)
sigma_slider = pn.widgets.FloatSlider(name=“σ”, start=0.1, end=5, step=0.1, value=1)

def func_wrap(df_displayed, time):
df_displayed = df_4_normYFP
times = df_displayed[‘Time’]
#return 0
return df_displayed.filter(pl.col(“Time”) == times[time]) #if I comment this line out, the code works fine!!!

@pn.depends(time_slider.param.value, sigma_slider.param.value)
def plot_inducer_YFP(time, sigma):
x = np.linspace(-10, 10, 200)
y = st.norm.pdf(x, loc=time, scale=sigma)

func_wrap(df_4_normYFP, time) 

return hv.Scatter(data=(x, y), kdims=["x"], vdims=["f(x ; µ, σ)"])

widgets = pn.Column(
pn.Spacer(height=30), time_slider, pn.Spacer(height=15), sigma_slider, width=300
)
pn.Row(plot_inducer_YFP, pn.Spacer(width=15), widgets)

HoloViews does not currently support polars, but that does not seem to be the problem. Can you try running the func_wrap outside the plot_include_YFP.

Hard to say without a minimal, reproducible example (MRE).