Changing step of `number_input` with another widget

I’d like to change the step parameter of a number_input widget programmatically. I’d like to provide the possibility to explore time series data changing an index (idx), but also allowing the user to jump further on the time series with a bigger step skipping uninsteresting points.

I’m doing it with this:

    _step = st.sidebar.number_input('step', min_value=1, max_value=20, value=1, step=1)
    idx = st.sidebar.number_input('idx', min_value=1, max_value=100, value=95, step=_step)

The problem is that if I change the step, the idx widget is set back to the default value.
Is there a way to avoid this behaviour?