I need to add a certain newLayer to each master. The glyph.layers.append() method apparently does this, but all I get is the append to to the first master. How can I decide, which master the added layer is gonna go to?

Heres my sketch:

thisFont = Glyphs.font
masters = thisFont.masters
thisMaster = thisFont.selectedFontMaster
activeMasterIndex = masters.index(thisMaster)
selection = thisFont.selectedLayers

for glyph in [g.parent for g in selection]:
	newLayer = GSLayer() = + " Original"
# 	glyph.layers.append(newLayer) ### go all to first master
	glyph.layers[activeMasterIndex].append(newLayer) ### not working

You have to set the associatedMasterID of the layer before you add it.

That’s it. Thanks!