Call Function in Workflow with Python

I can call the functions with Javascript in this way:

await function1()

But how can I do it with Python?

Hi @Timo,

Sorry, it's not possible to call functions in Retool Workflow with Python at this time. But you can use JavaScript to call Python functions in Retool Workflow. To do this, you can use the exec() function in JavaScript. The exec() function executes a string of JavaScript code.

To call a Python function in Retool Workflow using JavaScript, you can use the following steps:

  1. Create a JavaScript block in your Retool Workflow.
  2. In the JavaScript block, add the following code:
const pythonFunction = exec(`python -m my_module my_function`);

Replace my_module and my_function with the name of the Python module and function that you want to call.

  1. Connect the JavaScript block to the other blocks in your workflow.
  2. Run the workflow.

The exec() function will execute the Python code and return the result. The result will be available in the pythonFunction variable.

Here is an example of a Retool Workflow that calls a Python function:

# Call the Python function.
const pythonFunction = exec(`python -m my_module my_function`);

# Do something with the result.

This workflow will call the my_function() function in the my_module Python module. The result of the function call will be printed to the console.

I hope this helps!