I have an OpenModelica model made with OMEdit. In order to get a concrete example I designed the following:
I believe you are looking for the setParameterValue
command. You can read about it here: https://openmodelica.org/download/OMC_API-HowTo.pdf
Basically you would add a line similar to OMPython.execute("setParameterValue(myGain, a, 20)")
to your python script before the line where you run the simulation, so long as a
is a parameter in your model.