Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Python functions
  • Overview
  • How to proceed?
  • Importing the ".py" file
  • Using Python functions in WLanguage code
  • Caution
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
WLanguage allows for native Python calls.
The principle is very simple:
  1. Import the ".py" file into the WINDEV project.
  2. In the WLanguage code:
    • Load the Python DLL.
    • Call Python functions.
Remark: You can also execute Python functions via WLanguage functions. For more details, see Python: Use in WLanguage.
How to proceed?

Importing the ".py" file

Importing the ".py" file into the environment allows for the automatic recognition of all the functions of the ".py" script. Each function in the script is then considered as a WLanguage native function.
To import the ".py" file:
  1. Set up a Python interpreter. This interpreter will read the information contained in the ".py" file.
    • On the "Home" tab, in the "Environment" group, expand "Options" and select "General options of WINDEV/WEBDEV".
    • Go to the "Directories" tab and enter the path of the interpreter (python*.dll file) in "Python interpreter".
      Remark: This Python version can be different from the version used at runtime. However, it must be compatible with Python 3.9, the reference Python ABI used in WINDEV and WEBDEV. The Python interpreter must be the same architecture as WINDEV or WEBDEV (32 or 64-bit).
    • Validate the configuration window.
  2. Import the ".py" files via the "Project explorer" pane using one of the following methods:
    • Open the context menu of "External descriptions" and select "Import a Python module into this project". Select the file that corresponds to the module and validate.
      Remark: You can import all the Python modules from a given directory via "Import all Python modules from a directory into this project".
    • Open the context menu of "Other" and select "Add elements". Select the file that corresponds to the module and validate.
    • Drag the ".py" file from the Windows explorer and drop it onto the "Project explorer" pane.
  3. The Python file is in the project folder, and the module (with its functions) will appear in the "Project explorer" pane, in the "External descriptions" folder.
Remark: When developing the application, it is also necessary to indicate the path of the Python libraries used in the current project configuration:
  1. On the "Project" tab, in the "Project configuration" group, click "Current configuration".
  2. On the "Components" tab, specify the external Python libraries.

Using Python functions in WLanguage code

To use Python functions in WLanguage code:
  1. Initialize the Python engine using PythonInitialize. This function defines the Python interpreter used for the execution. You can use an interpreter different from the one used for the import, but it must be compatible with Python ABI 3.9.
  2. Enter the name of the Python function to execute, with its parameters if necessary.
    Caution: not all types can be passed as parameters. The default values of the parameters are not taken into account. Parameters are passed by value only. In addition, only the following types can be used to pass parameters, and for the return value:
    • Boolean,
    • Integer (signed or unsigned),
    • Real,
    • Character string.


  • The ".py" modules must be accessible on disk, in the folder of the deployed executable, or in the location specified with PythonAddPath. The ".py" modules cannot be found if they are embedded in the executable library.
  • Python is case-sensitive. The module and function names must be written using correct upper and lower case characters.
Minimum version required
  • Version 27
This page is also available for…
IF PythonInitialize("C:\Programs\Python\Python39\python39.dll") THEN
PythonExecute("test_module", "id", 5)
13 May 2024

É necessário setar corretamente o caminho do modulo python, para executar uma função em um módulo python:

sPythonModule is string

<IF ExecutionTarget=Windows>

sPythonModule = SysDir(srLocalAppData) + ..

13 May 2024

Last update: 05/14/2024

Send a report | Local help