Creating a callback function without @app.callback annotation


#1

Hi all,

A Dash newbie here. A question pops out recently while I tried to modelize my code into modules so that it can be quickly reusable : is it possible to have a callback function WITHOUT @app.callback annotation in order to referring which html elements will be updated?

Why I am asking so is that we can not pass parameters dynamically to an annotation in order to build a function dynamically. Any solution for this problem?

Thank you guys in advance.


#2

but how are you supposed to call the function without inputs?
you could have dummy divs as inputs/outputs with 'display' : 'none' or you could have an interval component to run the function in the background without input.


#3

Hi,

Thanks for the reply. I do have an input. It’s just that my input is dynamically generated so that its html id is not fixed.

This seems to be the solution? Handel multiple callback outputs programmatically


#4

Yep that’s what you’re after. Note that you’re still using callbacks, just not as decorators.