Schematic legacy BOM - variables in cmd line arguments?

I have my own Python script to generate BoMs, calling it using “Generate Legacy BOM” from schematic.

How do I transfer defined text variables to the command line arguments? I tried ${VARIABLE} but that just outputs the text “${VARIABLE}”

Thanks

Application: KiCad x64 on x64

Version: 9.0.2, release build

Libraries:
wxWidgets 3.2.6
FreeType 2.13.3
HarfBuzz 10.2.0
FontConfig 2.15.0
libcurl/8.11.1-DEV Schannel zlib/1.3.1

Platform: Windows 11 (build 26100), 64-bit edition, 64 bit, Little endian, wxMSW
OpenGL: Intel, Intel(R) UHD Graphics 770, 4.6.0 - Build 32.0.101.6129

Build Info:
Date: May 7 2025 02:29:49
wxWidgets: 3.2.6 (wchar_t,wx containers)
Boost: 1.86.0
OCC: 7.8.1
Curl: 8.11.1-DEV
ngspice: 44
Compiler: Visual C++ 1942 without C++ ABI
KICAD_IPC_API=ON

Locale:
Lang: en_GB
Enc: UTF-8
Num: 1,234.5
Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)