Dynamic Image names in callback

Hi All,

Just a question, how would I go about including dynamic image names in Dash Callbacks - I am in the process of migrating my images from external source to internal into the dash assets folder, subfolder PLImages

Currently, my dash snippet looks like this:

def p1_select(p_name):
    if p_name is not None:
        dff = df[df.P == p_name]
        return dff['ImageLink'].unique(), \

Now I want to use the internal call with the image name being p_name.png - meaning the p_name would need to be the name of the selected name, I imagine it would be something like this:

def p1_select(p_name):
    if p_name is not None:
        dff = df[df.P == p_name]
        return dash.get_asset_url("\PLImages\"+p_name+".png"), \

Can anyone advise as the above doesn’t work

Nevermind, I got it working, had my slashes the wrong way :rofl:

working code:

def p1_select(p_name):
    if p_name is not None:
        dff = df[df.P == p_name]
        return dash.get_asset_url("/PLImages/"+p_name+".png"), \