In order to be of any use, a plugin will need to make modifications to your song or library file. You can, if you want, make these inside your function. However, we don't suggest you do. The API can change in the future. Plus, many settings rely on other basic MMA settings which are easy to miss. Much more robust is the method of creating string(s) with native (or even other plugin) commands and returning the to the main script.
This is easy to do.
Just create a list of commands and push them onto the programs input stack. Examine the hello/plugin.py module for actual code, but as a summary you'll need to:
ret = [l.split() for l in ret]
gbl.inpath.push(ret, [gbl.lineno] * len(ret))
here we set the line number of each returned line to be the same as the current line being processed. Note: we're assuming that your plugin has imported ``gbl'' as detailed above.
Bob van der Poel 2016-06-11