is it possible for parallel execution of methods in the on_navigate? I tried ThreadPoolExecutor but showed an error Working outside of the application context.
def on_navigate(state: State, page_name: str) -> str:
page_actions = {
"Overview": [update_total_projects],
"Create": [create_update_available_projects],
"Edit": [refresh_edit_page_elements, edit_update_available_projects],
"Live": [live_update_available_projects, update_available_Machines,
update_available_Materials, update_available_Materials_Matrix, update_available_Materials_dis,
update_available_Applicators, update_available_nozzle_s, update_available_nozzle_d, update_available_nozzle_l]
}
Two solutions exist to simplify the use of thread and avoid these issues. You can either use:
invoke_callback: you can use it inside a Thread and use the State inside your function.invoke_long_callback: is using theinvoke_callbackbehind the scene to create a simpler syntax to make asynchronous calls.Here are some examples of code (Taipy 3.0):
For
invoke_long_callback:For
invoke_long_callback: