I may not understand what you are asking. Section 3.3.1 of the notation manual, "Including LilyPond Files", describes the use of \include. The \include command substitutes the contents of "
filename.ly" wherever "\include "
filename.ly"" is placed. (Sometimes the component files are named "*.ily" rather than "*.ly" to indicate that they will not compile on their own.) The component files typically contain variable definitions that are \include-ed at the top of the master file. Then the variables are called where needed. I've attached files that, if placed in a common directory, compile to the result you are looking for using 2.18.2.
Pete H.