Skip to main content

Call Workflow

Command Description

  • You can create multiple workflows in the same automation application. Each workflow is compiled to a separate Python file.
  • A called workflow can define input and output parameters.
  • Splitting a large automation into subworkflows makes it easier to understand and maintain.

Command Input Parameters

Input ParameterTypeDescription
Workflow NamestrName of the workflow to call. Use get_all_flow_names to retrieve the available workflow names

Dynamic input parameter rules:

  • Workflow Name is fixed and must identify the workflow to call.
  • Use get_target_tab_flow to retrieve the selected workflow's other input parameters.
  • Each key in JSON in must exactly match an input parameter name in the target workflow. Each value must be a Python expression available in the current workflow.

Command Output Parameters

Dynamic output parameter rules:

  • Use get_target_tab_flow to retrieve the selected workflow's output parameters.
  • Each key in JSON out must exactly match an output parameter name in the target workflow.
  • Each value in JSON out is a Python variable name, not a string literal. For example, write "ProductPrice": "ProductPrice", not "ProductPrice": "'ProductPrice'".

Example 1

Call Subworkflow B

Subworkflow B input parameters:

Parameter NameType
webPageWebPage
ProductNamestr

Subworkflow B output parameters:

Parameter NameType
ProductPricestr
ProductElementWebElement

The keys in out must exactly match Subworkflow B's output parameter names. The values are variable names and must not include Python string quotes.

[
{
"ins": "Open Webpage",
"in": {
"Browser Type": "'Google Chrome'",
"url": "'https://www.example.com'"
},
"out": {
"Webpage Object": "webPageObject"
}
},
{
"ins": "Call Workflow",
"in": {
"Workflow Name": "'Subworkflow B'",
"webPage": "webPageObject",
"ProductName": "'iPhone 15 Pro Max'"
},
"out": {
"ProductPrice": "ProductPrice",
"ProductElement": "ProductElement"
}
},
{
"ins": "Print Log",
"in": {
"Log Content": "f'''Product link: {ProductElement.href} Product price: {ProductPrice.replace('CNY ', '')}'''",
"Render HTML": "False"
}
}
]

Example 2

  • The subworkflow obtains the number of rows in the specified spreadsheet.

  • The current workflow waits until the subworkflow returns or finishes. In this example, the Example workflow executes line 4 before the Main workflow proceeds to line 2.

  • The calling workflow uses the returned result.