Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Circular Callbacks in Julia for Dash 1.6?

Can you do circular callbacks in Julia Dash?

It seems that this functionality was available in python’s dash 1.19…

But I can’t seem to replicate it in Julia… I do get an error message regarding circular callbacks though.

If its not implemented, any ideas on when it will be?

Hey @Wingmore this should work if it works in Python. Can you please post a small Julia code example here that’s not working?

Circular callbacks are documented in Advanced Callbacks | Dash for Julia Documentation | Plotly.

Code tried:

@time using Dash, DashHtmlComponents, DashCoreComponents, DashTable
@time using DashBootstrapComponents

external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]

app = dash(external_stylesheets=external_stylesheets)

app.layout = html_div() do
    [
        dcc_slider(
            id="slider-circular", min=0, max=20, 
            marks=[(i=string(i),) for i in 1:21], 
            value=3
        ),
        dcc_input(
            id="input-circular", type="number", min=0, max=20, value=3
        ),
    ]
end

callback!(
    app,
    Output("input-circular", "value"),
    Output("slider-circular", "value"),
    Input("input-circular", "value"),
    Input("slider-circular", "value"),
 ) do input_value, slider_value
    ctx = callback_context()
    trigger_id = ctx.triggered[0]["prop_id"].split(".")[0]
    trigger_id == "input-circular" ? value = input_value : slider_value
    return value, value
end 

ERror:

ERROR: LoadError: Circular input and output arguments were found. Please verify that callback outputs are not also input arguments.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] check_callback(func::Function, app::Dash.DashApp, deps::Dash.CallbackDeps)
   @ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:181
 [3] _callback!(func::var"#467#468", app::Dash.DashApp, deps::Dash.CallbackDeps; prevent_initial_call::Nothing)
   @ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:129
 [4] callback!(::var"#467#468", ::Dash.DashApp, ::Output{String}, ::Vararg{Dash.Dependency, N} where N; prevent_initial_call::Nothing)
   @ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:108
 [5] callback!(::var"#467#468", ::Dash.DashApp, ::Output{String}, ::Output{String}, ::Input{String}, ::Input{String})
   @ Dash C:\Users\Wingmore\.julia\packages\Dash\Weukk\src\app\callbacks.jl:104
 [6] top-level scope
   @ c:\Users\Wingmore\Desktop\everything\Julia tutorials\circular_callback_dash.jl:21
in expression starting at c:\Users\Wingmore\Desktop\everything\Julia tutorials\circular_callback_dash.jl:21

Your link redirects to the python one. Also I’ve noticed that the julia Advanced callback ends prematurely: theres some sections in python not in julia docu here:

https://dash-julia.plotly.com/advanced-callbacks