activities
latest
false
- 概述
- 加密
- 数据库
- Java
- Python
- 网页 API
开发者活动
上次更新日期 2026年4月21日
UiPath.Python.Activities.LoadScript
使您能够将 Python 脚本的处理程序存储在 PythonObject 变量中。
您可以使用生成的变量来调用代码中的方法。如果除脚本中存在的方法外还存在内联代码,则系统也会在运行时执行这些代码。
只能在“Python 作用域”活动中使用。
出于软件限制,默认情况下,此活动使用 Python 活动包的安装位置作为脚本的运行目录。
为了能够在脚本中使用相对路径,您可以将以下代码添加到加载的脚本中:
import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(<em>file</em>)))
import <your module here>
import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(<em>file</em>)))
import <your module here>
属性
常见
- DisplayName - The display name of the activity. This field supports only
Stringvariables.
输入
- Code - The Python code that you want to load. This field supports only String variables.
- File - The path to the file which contains the Python code that you want to load. This field supports only String variables.
其他
- “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
输出
- “结果”- 此为指定 Python 脚本的处理程序,存储在“
PythonObject”变量中。