# PYFUNC() > [HTML Version](pyfunc().htm) _Updated July 2026; see History_ PYFUNC() provides a means to call an external function written in Python version 3. **PYFUNC (module, funcname \{, arg1, ... argn\}) \! (numeric return value)** **PYFUNC\$ (module, funcname\{, arg1 ... argn\}) \! (string return value)** where: _module_ (String) \[in\] filespec (native format) of the module containing the function; (default extension py) _funcname_ (String) \[in\] name of the function to call _arg1 ... argn_ (any scalar type) \[in\] zero or more arguments to the function PYFUNC uses the Python C interface API to initialize the Python environment. If necessary, certain Python environment variables can be set via the file %MIAME%/pyconfig.ini, formatted as follows: \[Python\] ;Base directory for Python installation (executable) HOME=C:\\Program Files (x86)\\Python312-32 ;PLATLIBDIR= The pyconfig.ini file can be eliminated if Python is set up to run from the command or shell prompt without explicit settings. Unlike other A-Shell function interfaces, the parameters here are all read-only, so if the function is to return anything to caller, it must be done through the return value of the function, either a scalar or an auto-extend array. Examples: city\$ = pyfunc\$("./geo.py", "capital\_of", "California") median = pyfunc(".math.py", "median", 5, 23, 15, 100, 44, 11) dimx ary(0), b, 2, auto\_extend ... ary() = pyfunc("./mymod.py", "myfunc", 10, 20, 30) Warning: this interface is still in the experimental stage. We're not yet sure if there's really any application for it, and there are a number of complexities that will need to be sorted out. Developers are advised to provide feedback to us before investing too much effort into it. **History** 2026 July, A-Shell 7.0.1786: Add support for ellipsis in PYFUNC() argument lists. This is mainly useful for creating wrapper functions, for example: result = Fn'PYFUNC'Wrapper(status, pymodule\$, pyfunc\$, arg1, arg2) ... function Fn'PYFUNC'Wrapper(status as i2, pymodule\$ as s0, pyfunc\$ as s0, ...) as f6 on error goto trap .fn = PYFUNC(pymodule\$, pyfunc\$, ...) status = 1 \! success xputarg @status exitfunction trap: status = -err(0) .fn = -1 xputarg @status endfunction