Hi all! how to kick-off flow defend on another flo...
# ask-community
a
Hi all! how to kick-off flow defend on another flow is success? Thanks
a
@Anh Nguyen you would need to set
Copy code
raise_final_state=True
Here is a full example:
Copy code
from prefect import Flow
from prefect.tasks.prefect import create_flow_run, wait_for_flow_run


with Flow("flow_of_flows") as flow:
    flow_run_id = create_flow_run(flow_name="x", project="community")
    wait_until_this_child_flow_succeeds = wait_for_flow_run(
        flow_run_id, raise_final_state=True
    )
    # this will only run if the flow run of flow X succeeded:
    yet_another_child_flow_run_id = create_flow_run(flow_name="y", project="community")
    flow_run_view_for_this_run = wait_for_flow_run(
        yet_another_child_flow_run_id, raise_final_state=True
    )
Note that both child flows must be registered beforehand in order to be triggered from a parent flow.