Sync Components Across Master doesn't work

Guys, sorry for asking this because I have zero skill in coding/scripting, so I really don’t understand the problem at all. But if you have suggestions to learn more about this let me know.

*I’ve read the Scripting tutorial in learn glyphs but still confusing when facing a problem like this.

# add code here # MenuTitle: Sync Components Across Masters
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__ = """
Takes the current layer’s components, and resets all other masters to the same component structure. Ignores paths and anchors. Hold down Option key to delete all paths and anchors.
from AppKit import NSEvent, NSAlternateKeyMask
from GlyphsApp import Glyphs, GSComponent

thisFont = Glyphs.font  # frontmost font
listOfSelectedLayers = thisFont.selectedLayers  # active layers of selected glyphs
print(f"Sync Components Across Masters for {thisFont.familyName}:")

# combo key held down:
keysPressed = NSEvent.modifierFlags()
optionKeyPressed = keysPressed & NSAlternateKeyMask == NSAlternateKeyMask
if optionKeyPressed:
	print(f"Opt key detected: will reset layers, not just add components.")

def process(thisLayer):
	thisGlyph = thisLayer.parent
	layerID = thisLayer.layerId

	# only act if components are present:
	if len(thisLayer.components) == 0:
		print(f"  ⚠️ No components on layer {}, skipping.")

	compatibilityRun = None
	for layerGroup in thisGlyph.layerGroups():
		layerGroup = tuple(layerGroup)
		if layerID in layerGroup:
			compatibilityRun = layerGroup

	if compatibilityRun is None:
		print(f"🆘 No interpolating layers found in glyph {}, skipping...")

	for thatLayerID in compatibilityRun:
		thatLayer = thisGlyph.layerForId_(thatLayerID)

		if thatLayer is thisLayer:
			# source layer

		newComponents = []
		for thisComp in thisLayer.components:

		if Glyphs.versionNumber >= 3:
			# GLYPHS 3
			if optionKeyPressed:
				# clear all:
				thatLayer.shapes = None
				thatLayer.anchors = None
				# clear components:
				for i in range(len(thatLayer.shapes) - 1, -1, -1):
					shape = thatLayer.shapes[i]
					if isinstance(shape, GSComponent):
						del thatLayer.shapes[i]
			# add components:

			# GLYPHS 2
			thatLayer.components = newComponents
			if optionKeyPressed:
				if thatLayer.anchors:
					thatLayer.anchors = None
					print("    Deleted anchors")
				if thatLayer.paths:
					thatLayer.paths = None
					print("    Deleted paths")

		print(f"  🆗 {}")

thisFont.disableUpdateInterface()  # suppresses UI updates in Font View
	for thisLayer in listOfSelectedLayers:
		thisGlyph = thisLayer.parent
		print(f"🔠 Syncing components in {}...")
		thisGlyph.beginUndo()  # undo grouping
		thisGlyph.endUndo()  # undo grouping
	print("\n✅ Done.")
except Exception as e:
	print("\n⚠️ Script Error:\n")
	import traceback
	raise e
	thisFont.enableUpdateInterface()  # re-enables UI updates in Font View

And this:

Thank you guys!

The script was updated to use api that is apparently only available in the cutting edge version of Glyphs 3.2. We’ll have a look.