PythonInvokeModule_

Syntax

PythonInvokeModule_(ModuleId: String, FunctionName: String, Params: Array)

Parameters

ModuleId. Python module identifier in a repository.

FunctionName. The executed function name. Parameter value is case-sensitive.

Params. Parameters sent to function. Function parameter values can be sent as a separate array or listed and separated with a comma. If the executed function does not contain input parameters, do not specify Params.

Description

The PythonInvokeModule_ method executes the function stored in the Python module, and returns result of its work.

Comments

When creating formulas, the use of named parameters is unavailable.

Example

Consider the Python code contained in the Python module with the MOD_PYT identifier:

def calculate(a, b)
    return b%a+a
def check(value)
    if (value>1000):
        return 1
    else
        return 0

The table contains examples of formulas using the PythonInvokeModule function:

Formula Result Description
=PythonInvokeModule("MOD_PYT", "calculate", 4, 40) 4 The calculate function call from the Python module in the repository with the MOD_PYT identifier. Fixed values are sent as values of parameters.
=PythonInvokeModule("MOD_PYT", "check", C3) 1 OR 0 The check function call from Python module in the repository with the MOD_PYT identifier. The value of the C3 cell is sent as the parameter value. If the cell value is greater than 1000, then 1 is returned, otherwise - 0.

See also:

Functions Available in Expression Editor | Working with Python | Python.InvokeModule