> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/references/call-workflow.md).

# 调用工作流

调用工作流是允许正在运行的脚本（父工作流）调用并执行系统中已创建的另一个脚本（子工作流）的操作。这是一个强大的工具，可以将复杂的流程拆分为独立管理的模块，从而优化自动化逻辑的重用。

> ⚠️ 请注意，测试操作功能对调用工作流无效。

#### 配置参数：

• 参考文件：从您的子工作流列表中选择。

#### 工作机制：

当父工作流运行到调用工作流步骤时，系统将暂停主线程，将执行权转移到子工作流。子工作流完成后，系统将自动返回父工作流并继续执行后续步骤。

您可以通过点击主工作流右上角的 + 号来创建子工作流 -> 选择创建新工作流（如果是新建）或从现有文件导入（如果是从已有文件选择）。

#### 实际示例：自动登录账户流程

假设您为多个 MMO 项目编写批量账户养成脚本，而不是在每个脚本中编写登录代码，您创建了一个名为 `login_module` 的独立工作流：

• 步骤 1：在主工作流中，打开浏览器后，您拖动调用工作流操作。

• 步骤 2：在参考文件部分，您选择 `login_module`。

• 步骤 3：在参数部分，您将变量 `$user` 和 `$pass` 从主工作流传递到子工作流。

• 步骤 4：当主工作流运行到这里时，它将“调用” `login_module` 完成填写用户/密码、点击登录、处理验证码等操作。之后，它会自动返回主工作流以继续执行工具、进行空投或发布产品等任务。

技术注意事项：

• 确保子工作流已保存并在调用之前检查逻辑。

• 检查父工作流和子工作流之间变量名称的一致性，以确保数据准确传递且不冲突。要使用子工作流的变量，您需要按照语法：`$工作流名称_变量名称`，例如如下图所示，在主工作流中，如果在 login\_module 中有变量 `$status`，则在主工作流中使用时需要填写为 `$login_module_status`。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/references/call-workflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
