I was developing an app that has a callback that returns A, for the first time it runs, and returns B every time afterward.
The way I was doing this was via having the callback listen to a dcc.Interval
object’s n_intervals
, and have “A be returned” whenever the conditional if n_intervals == 1
was satisfied (and this would obviously only be satisfied the first time the callback ran).
However, I learned I had to manually reset n_intervals
to 0
whenever I set max_intervals
to 0
to pause dcc.Interval
(because I want to temporarily stop triggering my callback every interval). This has led to some circular Dependency Cycle error, so I can’t do this anymore.
So, essentially I am asking two things that I hope someone can help me with: 1) is there a way to have an interval object’s n_intervals
automatically reset to 0, if max_intervals
is also, and 2) is there a better way to have a callback run a specific way only once the first time it is run?