Importing Data from Python Scripts

You can import data directly from a Python script, either by entering the script directly in the task, or by referencing an external script file.

This type of operation may be useful if you want to apply an external script to data before using it in a Rulex workflow, in order to perform a specific operation that requires a low-level programming language, such as deciphering badly formatted text files.


  • you must have created a flow;

  • Python 3 software has been installed where Rulex is running.

  • IPython3 has been installed on the machine where Rulex is running (via pip install ipython)

  • Miniconda must have been installed on the machine where Rulex Factory is running.

We strongly recommend you to use Python 3.10. After having installed Miniconda, check on your machine that Python 3.10 has been installed. If not, install it manually.


  1. Drag the Python Import Bridge task onto the stage.

  2. Double click the Python Import Bridge task.

  3. Configure the script options as described in the table below.

  4. Save and compute the task.

Python options



Advanced Configuration options

Select executable type

Select the executable type you want to use in the task. The options available are:

  • Conda

  • Python

The Configuration tab changes according to the selected executable.

Executable file area

Drag the Python executable file on this area if you have chosen Python as the executable file type, or drag the conda executable file here if you have chosen Conda as the executable file type. You can browse on your machine to upload the file by clicking on the Select button.

Configuration tab

Use user environment

Select this checkbox if you want to use the environment created by Rulex. This option is available only if Conda has been chosen as the executable file type.

Select Conda Environment

In this drop down list, choose the Conda environment you want to use in the task. This option is available only if Conda has been chosen as the executable file type.

Console tab

Connect Python Bridge

Click on it to open the Interactive Console, where you can write the Python code.

Interactive Console

Here you can write the code which will be executed within the task.

The dataset is saved as r_dataset onto the task. So every time you need to write code referring to the dataset, use this reference in the Console or in the Script tabs. The dataset is saved in a variable python dataframe. The flow variables are saved as r_vars.

Save History

Click on this button to save the changes made to the code. The code will be printed in the Script.

Clear History

Click on this button to delete all the changes made to the code.

Script tab (available for both Python and Conda executable files)

Python Editor

Here you can visualize and edit the Python code, just like in the Interactive Console in the Console tab.

Execute Code

Click this button to execute the code and visualize the results in the Last Execution Output area.

Save Code

This button saves the code written in the Script area.

Last Execution Output

Here you can visualize the output of the last code execution.