There might be more elegant ways to do it (there probably is), but I have a variable I define in my output files, is-loaded-file and then I can use #(if (defined? 'is-loaded-file) … ) in the definition files to test. This requires a situation where there’s a clear separation between ”definition files” and ”output files”, but works quite well for me.
> 14 sep. 2021 kl. 09:52 skrev Omid Mo'menzadeh <omid.mnza...@gmail.com>: > > Hello all. This might be a weird thing to seek, but here is the scenario: > I have several files defining (but not using) different parts of the score, > which other files use to construct several output types. > > But the problem is the command `lilypond -l WARNING -o /path/to/file.ly` does > not show a warning for the following example file: > ghigh = \relative c { > \clef "treble_8" > \time 4/4 > \voiceOne > c2 | > } > > It does, if I include the following part at the end of the file: > \book { > \ghigh > } > > But the problem is that when I include it in another file, I get an extra > output! > > A possible solution could look like an `if __name__ == "__main__"` clause in > Python, but I don't know if we have a similar variable available in Lilypond. > Thanks in advance, > Omid