Skip to end of metadata
Go to start of metadata

Dynamic Python

Author: Jerry Chae


The Dynamic Python plugin takes a Python script and runs it. Additionally, when the Python script has any 3rd party Python modules integrated, the plugin automatically downloads and installs them in the local virtual environment for PAM. You can pass on parameters to the Python script as well. This plug in requires Python coding skills.


Use Dynamic Python carefully

Dynamic Python alters the virtual environment file without going through PAM’s VENV Manager features. This may result in some infrequent case where a potential resource conflict may be observed when PAM tries to run another Automation Scenario with the virtual environment. When this happens, no error messages will be displayed. PAM just cannot run any Automation Scenarios anymore.

If you encounter a case like above, please just delete the virtual environment file at:


The virtual environment file has a file name with date-time like “20210402-165006”.

Need help?

Technical contact to

May you search all operations,

Input (Required)

Python script file, usually a text file with extension .py (see example below.)

Input (Optional)

Req Text

requirements.txt file is the standard text file that lists the 3rd party Python modules that the main Python script will be calling for.


Parameters are defined in the main Python script (see example). You can pass on parameters by using the notation ::= as in Python

Encoding option

If the input file uses any other encoding options than UTF-8, you can specify it here.


Return Value

This plugin does not return any values

Return Code

        0 for success

        9 for failure

How to set parameters

Text from Image

Example of files

Python script

file name = Dynamic Python-3.402.913

import glob
import os
import pandas as pd
from pandas import ExcelWriter
from openpyxl import load_workbook

wdir = r"{wdir}"
in_files = (
    os.path.join(wdir, '1.xlsx'),
    os.path.join(wdir, '2.xlsx'),
    os.path.join(wdir, '3.xlsx'),
out_file = os.path.join(wdir, 'task2.xlsx')
writer = ExcelWriter(out_file, engine='openpyxl')
num_rows = 0
for filename in in_files:
    excel_file = pd.ExcelFile(filename)
    (_, f_name) = os.path.split(filename)
    (f_short_name, _) = os.path.splitext(f_name)
    for sheet_name in excel_file.sheet_names:
        df_excel = pd.read_excel(filename)
        num_rows += df_excel.shape[0]
print(os.path.abspath(out_file), end='')

File name = Dynamic Python-3.402.913

# requirements.txt for pandas handling


Update 2022.02.08

Text from Image