Clear_data is not working for dcc.Store

I get this error when I try to clear the data stored in dcc.Store component
NameError: name 'clear_data' is not defined

Here’s the code:

@app.callback(Output('memory-output', 'clear_data'),
                     [Input('reset_button', 'n_clicks')])
def clear(reset_clicks):
    '''Clears memory'''
    if reset_clicks > 0:
        clear_data is True

The error says it correctly: You did not define clear_data in your function.
you are not trying to set a value ( clear_data is True means that you are checking if it is True or not, getting a boolean as an output) and you are not returning anything either.
The code should be the following:

@app.callback(Output('memory-output', 'clear_data'),
                     [Input('reset_button', 'n_clicks')])
def clear(reset_clicks):
    '''Clears memory'''
    if reset_clicks > 0:
        clear_data=True
return clear_data

I must have wrote this code when I was very tired haha. I meant to do which similar to what you wrote. Thank you

@app.callback(Output('memory-output', 'clear_data'),
                     [Input('reset_button', 'n_clicks')])
def clear(reset_clicks):
    '''Clears memory'''
    if reset_clicks > 0:
        return True
three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online