Python has a library called Lilypond which can be used to generate sheet music from a text based input. The documentation shows that the normal use is to create the text file, and then from a command line execute the lilypond
executable with the text file as the first argument, which then outputs a PDF file.
How can I instead generate the PDF of sheet music programatically from inside another python program by calling Lilypond APIs? I am not interested in making system calls from Python to the lilypond executable.