Applying python function on selected range with rangeslider

I’m fairly new to plotly, this is my first project using it.

I’m running a Flask server and plotted a simple time series with Plotly which I can select a range from (like this For now the only use of this is to zoom on a part of the time series. But I want to process this part of the series with a Python function.

I’m looking for a way to get the start and end dates of the range slider so I can use them as arguments in a Python function. Is there a purely python way to do this (I’ve never used JS)? Or do I have to overwrite the existing JS functions to achieve this?

Unfortunately the doc didn’t help me and my searches didn’t return anything. I’m sorry if I missed anything!

If your plan is to put this into a jupyter notebook, you can probably do what you want with an ipython slider widget

Otherwise, maybe you can find your answer using #dash with a dash RangeSlider. You can read more about what dash is here.