Lua is available in LibreCAD 3, but it is still not in a productive state.
Have a look at this pseudo-scripting article in the wiki:
https://wiki.librecad.org/index.php?title=Pseudo-Scripting_With_ExcelIt uses the command file feature in 2.2. A command file is a simple text file with valid command line commands, separated by a semicolon.
The article uses spreadsheet software to create the script file, but when you are comfortable with Python, this will surely work too.
I'm not sure if anybody has ever tested this feature with tens of thousands of commands.
But if there are any limits, you can create multiple command files and execute them all in one drawing.
Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution