I would like to create h2o_wave interactive app (not a script) with several pages/screens (using tabs), one of which would display a dashboard with continuously updated charts in real time. Something like this https://wave.h2o.ai/docs/examples/dashboard, but as an interactive app (https://wave.h2o.ai/docs/apps). The goal is to create a GUI for data logger device.
Creating a dashboard as a script, for example following this tutorial https://wave.h2o.ai/docs/tutorial-monitor, is easy, but when i try to replicate it as an app (following this example https://wave.h2o.ai/docs/examples/tab-delete), the code execution gets stuck on a while loop that redraws the charts and anything beyond won't get executed - in the navigation bar example it gets stuck in await display_tab(q) where i put the chart redraw while True loop.
So how should one combine these two concepts in a single app?
H2O Wave lead maintainer here.
Python programs run in a single thread. By telling your code to run the same code over and over (infinite loop), you basically kill the thread. What you want instead is to run your updates in a background job (task/process) and keep the main thread free to run further, listen for user events, etc.
See this blog post to learn how to deal with background tasks in (not only) Wave.