Calling bind on a bound function


I have the following use case.
I have a dictionary all_cnec_results in which values are Pandas dataframes, and keys are week names stored in week_folders.. These dataframes are indexed with datetime indices.
I have a first select menu in which I choose which week I want to use:

week_select = pn.widgets.Select(name='Select result batch', options=[w for w in week_folders])

Then, I want to create a datetimepicker which lets me choose from possible timestamps within the selected weeks. Finally, I want to use the chosen timestamp to extract the part of the dataframe based on this chose timestamp.
To do so, I have implemented a function that returns start time, end time, and default value for the datetimepicker, which I bind to the Select widget above:

def get_start_end_times(cnec_results,week):
    cnec_results = cnec_results[week]
    # Get datetimes
    start = cnec_results.index.unique().min()
    end = cnec_results.index.unique().max()
    return {'start': start,'end':end, 'value': start}
start_end_times = pn.bind(get_start_end_times,cnec_results=all_cnec_results,week=week_select)

Then I create the DateTimePicker from this:

datetime_picker2 = pn.widgets.DatetimePicker(name='MTU',refs=start_end_times, enable_seconds=False)

And finally I bind a function called “get_cnec_names” that extracts the part of the dataframe I am interested in:

cnec_names = pn.bind(get_cnec_names,cnec_results=all_cnec_results,week=week_select,mtu=datetime_picker2)

The problem I have is that the datetime_picker is not updated when I choose a new week in the Select widget, and so nor is the table I extract in the end.
I think my problem boils down to using a bound function (start_end_times in my case) as input for a widget so that some widget parameters get updated when the bound function reacts to changes in one of the parameters it’s bound to.
What would be the correct way to go about this?