Python Module
  • 23 Jun 2021
  • 1 Minute to read
  • Dark
    Light

Python Module

  • Dark
    Light

Article Summary

Overview

The Python Module allows a user to execute Python scripts.

Prerequisites
The following is required before using the Python Module:


The following Python script will be used in the example.

import sys
def main():
    print("Welcome", sys.argv[0])
    if len(sys.argv) == 3:
        print(" ", sys.argv[1], " ", sys.argv[2])
if __name__ == "__main__":
    main()

Example

This example will demonstrate how to install the Python Module and adding a python script with two string inputs.

  1. Navigate to System > Settings. Click on Python Module Settings and enter the path of a python.exe file. Click SAVE.
  2. Navigate to System > Integrations. Right-click Python Script Projects and select Add Script Project. Name the project (Python Project 1) and click SAVE.
  3. Right-click on the script project and select Add Script.
  4. Name the script (PythonTest) and upload the Python file. Enter names for the Inputs (string1, string2) and click SAVE.

  5. On the Designer Project, click CREATE FLOW from the Global Action Bar and select Flow. Name the Flow (Python Flow) and click CREATE.
  6. To add the Python script to a Flow, navigate to Integrations > All Integrations > Python. Then, select the Python project and select the script and click ADD.
  7. With the step selected, change the input value mappings to Constant and enter "Hello" for string1 and "World" for string2.

  8. Add a Show Popup step to the Success path. Enter "Message" as the Subject. Click Unknown next to the Message field and select Select From Flow. Select Script Output [String] and click DONE.
  9. Connect the Error path and Done path to the End step.
  10. Click Save to save changes to the Flow.

Debug

  1. On the top action bar, click Debug. Then, click START DEBUGGING.
    The Popup will display the output from the script and the input strings.





Was this article helpful?