# Python

## Introduction

This document provides an overview of the integration between Automate and Python, explaining how Python codes can be executed to automate processes using Python library actions.

The integration enables users to execute Python scripts within Automate, facilitating automation of various tasks.

## What is Python?

Explain the core functionalities and benefits of Python.

**Overview of Python:** Python is a high-level programming language known for its simplicity and readability. It is widely used for various purposes including web development, data analysis, artificial intelligence, and automation.

**Key Features:**

* <mark style="color:orange;">Script Execution:</mark> Execute Python scripts to perform tasks.
* <mark style="color:orange;">Variable Assignment:</mark> Assign output of scripts to variables for further processing.
* <mark style="color:orange;">Flexibility:</mark> Supports both script file execution and direct entry of Python code.

## Automate Integration with Python

**Overview of Integration:** Automate integrates with Python to execute scripts and automate various tasks within workflows.

**Examples of Automated Tasks:**

* Running Python scripts to process data.
* Automating repetitive tasks using Python code.
* Integrating Python scripts into complex automation workflows.

## Using the Integration

The "[Open Action](#open-action)" feature within this Python scripting tool serves the purpose of preparing a Python script for execution. Users can either select an existing Python script file by defining its file path or utilize the built-in code editor to write a new Python script from scratch. Once the script is prepared, users assign its data to a variable, which serves as input for the subsequent "[Run Action](#run-action)." The "Run Action" then executes the Python script, either by selecting the previously defined script variable or directly entering Python code. The output generated by the script can be assigned to a variable for further processing, completing the execution cycle seamlessly.

## How To Use Actions

### Open

**Description:** Prepare Python script for execution.

**Purpose:** Define or select Python script to be executed.

**Usage:**

1. Define or select the file path of the Python script.
2. Alternatively, write Python script using the built-in code editor.
3. Assign the Python script data to a variable for input in the Run Python action.

**Inputs:**

* <mark style="color:green;">File Path or Python Script</mark>

**Outputs:**

* Python Script Data Variable

![Select File](/files/Sx7xuwR6zW6i30QNFfB4)

![With this option we can select the .py from the Data Store.](/files/k2Qu7Sh9BRTNgMqS084A)

![We can just write the .py code itself to the action itself. For doing this, after choosing the manual input action choose the “Open Code Editor”.](/files/zv6p0dmlXDQW8ahHlcHY)

![](/files/1KYzz8Bweu8R9GXp7Omv)

### Run

**Description:** Execute Python script.

**Purpose:** Execute Python script and capture output.

**Usage:**

1. Select the script variable defined in the Python Open action.
2. Choose a Python script file or enter Python code.
3. Assign the output of the Python script to a variable for further processing.

**Inputs:**

* <mark style="color:green;">Script Variable</mark>

**Outputs:**

* Output of the Python Script

![](/files/6j47Em7kkkvqBzfJSS6q)

![At this action we will define the value of “Open” to the Choose Script section. For the output of the “Run” action, we need to define another string variable. At the end we can use the output of the python in the flow.](/files/kaAcTQ14YE45Te7NUf3Q)

***

## Additional Tips

### [**Use Cases**](/userguide/use-cases.md)

### [FAQ](/userguide/faq.md)


---

# Agent Instructions: 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:

```
GET https://docs.autommate.com/userguide/libraries/integration/python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
