Thread
#prefect-community
    f

    Frederick Thomas

    3 months ago
    Hi all! We're using Prefect version 0.14.17 and have an issue with running a flow from within another in a python script. I used the following from the docs:
    from prefect import Flow
    from prefect.tasks.prefect import create_flow_run, wait_for_flow_run
    
    with Flow("parent-flow") as flow:
      # Create the child flow run, look up the flow by name
      child_run_id = create_flow_run(flow_name="gotta-run-flow")
    and got this:
    ImportError: cannot import name 'create_flow_run' from 'prefect.tasks.prefect' (/usr/local/lib/python3.8/site-packages/prefect/tasks/prefect/__init__.py)
    Could someone please assist? Thanks!
    Kevin Kho

    Kevin Kho

    3 months ago
    create_flow_run
    is 0.15.0 and up. That version has
    StartFlowRun
    though
    f

    Frederick Thomas

    3 months ago
    Hi Kevin! What is the import path or documentation?
    Martin T

    Martin T

    3 months ago
    Good question.https://docs.prefect.io/orchestration/flow-runs/creation.html#task says:
    from prefect.tasks.prefect import create_flow_run
    while https://docs.prefect.io/api/latest/tasks/prefect.html#create-flow-run says:
    from prefect.tasks.prefect.flow_run import create_flow_run
    Kevin Kho

    Kevin Kho

    3 months ago
    It’s equivalent because the init file of
    prefect.tasks.prefect
    imports it. The import in the original snippet is right. It’s just your Prefect version is too low Fredrick
    f

    Frederick Thomas

    3 months ago
    Thanks @Kevin Kho the issue of low Prefect version will be rectified shortly.