For the os.system() calls, you'll import os. The string that goes in the parentheses is the same as what you would input to a command line such as:
Setting the command in the same line.
os.system('vspaero -omp 4 myaircraft_DegenGeom')
Setting the command in a string variable and sending that to the system call.
vsp_pardrag_command = 'vspscript -script RunParasiteDragExample.vspscript myaircraft.vsp3'
os.system(vsp_pardrag_command)
Setting the command in the same line while passing input and output files.
os.system('flops < FlopsInputFile.in > FlopsOutputFile.out') * In this case you are passing the program an input file with '<' and telling it what the output file is called with '>'. Also works with XROTOR, XFOIL, and other tools.
Now, you _could_ just edit the vspaero input file manually with a string replace operation (or just write a new one each time) but this requires a lot of file operation, parsing, saving, etc. which takes extra time. If you are running a large design space, this will significantly lengthen your runs. Better is to write the VSPSCRIPT file to directly interact with the Analysis Manager and Results Manager exactly as shown in the example scripts and the API documentation. This will let you grab the results you want directly from memory and write that out in a format or structure that's easy to manipulate and plot. Here's the rub. Because you are executing VSP from a system call rather than directly from the Python API, the Results Mgr won't be in memory for Python to grab without parsing a file. At least, I don't think you can pause the os.system call while the results are still in memory somewhere and interact with that location through Python. I could be wrong but it sounds tricky if possible. Unless you are running several hundred cases or more, parsing the output files to get the values into Python memory as lists, dictionaries, Classes, etc. will probably work okay.
String replace is really easy in Python. Here's an example where I use a template file, with the parts I wanted to replace set as specific strings, to create the input file for a FLOPS case.
with open(TemplateFile, "rt") as fin:
with open("FlopsInputFile.in", "wt") as fout:
for line in fin:
fout.write(line.replace('WINGCARGOWEIGHT', WingCargoWeight)
.replace('GENERATORWEIGHT', GeneratorWeight)
.replace('ELECTRICALWEIGHT', ElectricalWeight)
.replace('NEWTHRUST', NewThrust)
.replace('EXTRACTEDPOWER', ExtractedPower)
.replace('FUELLEAKRATE', FuelLeakRate)
.replace('CDOFRACTION', CD0Fraction))