Using Python Node In Interplay

Written By Chetan Iterate ()

Updated at April 19th, 2022

Until now we have exclusively used JavaScript for creating Node, we wonder that can we use any other languages other than JavaScript?

Surprise surprise! We can use Python and Python 3 for our tasks with python rules for syntax, function, and data types.

But first, we have to understand the properties and mechanism of working with nodes.  A Node always has these two properties.

__msgid: This property denotes the unique identification of a node in flow. Every node always has __msgid property.

payload: This property always consists of the data which are commonly shared between nodes, every node, and its function. It consists only of the JSON object and can be displayed using a simple console.

Let's make a flow using python.

Steps 

1 ) Search and drag-and-drop 'inject' node in the workflow. This time we inject a string.



2 ) Now edit the inject node as below.



3 ) Now drag-and-drop the python 3 function Node and double click on it to edit its properties.



Note: for python 3 Here Inject node injects the payload in the given python function, so by itself it passed the given string under the name 'payload' for using the injected string such as 'variable_name['payload']'.

4 ) Now search for node 'console' module for console output, drag to the workflow and it will automatically rename itself so what it should be assigned for Edit the properties as follows.

5 ) Now the flow is complete, click on Deploy. To see the effect, click on debug button on the bottom to reveal the current status of the flow. You should see an output on the menu with the message you wrote.

Yess! you can Now Celebrate! You have created your first flow with Python 3 Code!

Was this article helpful?