Not sure if I missed this in the tutorials or if I’m missing something more fundamental in python.
I’m working through the tutorials (Part 3. Interactive Graphing and Crossfiltering | Dash for Python Documentation | Plotly ) and seeing multiple @app.callback tied to functions.
The tutorial pages mention a callback ‘wrapping’ a function, other than the adjacency in code, I’m not seeing a naming convention to tie a callback to a function.
last forum discussion seems to be over a year ago.
Hey everyone,
I’ve been learning Dash over the past few days and am going through the tutorial. As I’ve done more and more callbacks, I realized app.py file was getting way too big. I’m afraid that in a real-case scenario, having the callbacks within app.py file might be a mess, so I’d like to have the following architecture:
app.py that contains the main app and its layout
callbacks1.py that contains some callback functions
callbacks2.py same thing
I’ve ALMOST managed to make it work. Here…
above thread mentions slapdash
opened 11:15AM - 29 Oct 18 UTC
closed 04:42PM - 29 Oct 18 UTC
The Dash guide shows how to create a Dash app in a single file. However, the app… file quickly grows to several hundred files for a moderately sized dashboard. The question of how to organize Dash apps, so that callbacks are in a separate file, has been raised several times in the Dash community forum without help. Please add a recipe for how to break down a Dash app into separate files, as can be seen in the Dash [slapdash boilerplate](https://github.com/ned2/slapdash/tree/master/src/slapdash). The Slapdash project is well-designed, but leaves a lot to be desired in terms of explaining **why** the files are structured in such a way and **how** to create a simple Dash project with that file structure.
opened 11:06AM - 29 Oct 18 UTC
closed 12:58PM - 28 Nov 18 UTC
The Slapdash project is very nice for getting started quickly. However, it might… be useful to document some of the design decisions that went into the project structure. For example, how does the file structure allow callbacks to be separated into their own file? The monolithic file structure of default Dash apps is of shared concern, and [it is particularly difficult to separate out callbacks](https://community.plot.ly/t/callbacks-in-a-separate-file/15034).
Hey @aspiringguru
It might help you to read up on the decorator syntax in Python. Maybe this past answer will clarify things a bit?