Um, well, the examples are deliberately simple. I think that like (as an important example, and almost sorry to pick on them) the otherwise extensive matplotlib examples, some of the lmfit examples might also give the incorrect impression that fitting scripts need to be simple scripts (akin to confusing matplotlib with matplotlib.pyplot).
That is, one can (and people have) write code that programmatically sums models, perhaps using a class or perhaps just a function to build a model. One "almost simple" approach (that I never actually use myself, preferring classes or GUIs to build models) would be something like:
def build_model(ngaussians=3, background_type='linear'):
model = None
if background_type.startswith('lin'):
model = LinearModel(prefix='bgline_')
elif background_type.startswith('quad'):
model = QuadraticModel(prefix='bgquad_')
for i in range(ngaussians):
if model is None:
model = GaussianModel(prefix='g1_')
else:
model += GaussianModel(prefix=f'g{i+1}_')
return model
Of course, that's completely untested and you can make that more complicated if you want ;).
--Matt