Thank you for your reply. This is working, but like this: main = #(if (not (defined? 'is-loaded-file)) #{ \score { \vocal } #} )
\main Any idea why it wouldn't work without defining the main variable? It's fine for me, but I don't get why the following snippet does not work for me: #(if (not (defined? 'is-loaded-file)) #{ \score { \vocal } #} ) I'm using Lilypond 2.22.1 if that makes a difference. On Tue, Sep 14, 2021 at 12:44 PM Leo Correia de Verdier < leo.correia.de.verd...@gmail.com> wrote: > 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 > >