How to add a smartcomponent from glyph directly

smart-test.glyphs (19.4 KB)

import copy
smartGlyph = Glyphs.font.glyphs['_part.x101']
glyph = Glyphs.font.glyphs['test']

glyph.layers[0].components.append(smartGlyph.layers[0].components[0].copy())

AttributeError: ‘NoneType’ object has no attribute ‘copy’
_part.x101 is a smartcomponent glyph.
I don’s know why the script is error.
thanks.

You like to add the ‘_part.x101’ as a component to ‘test’?

glyph = Glyphs.font.glyphs["test"]
component = GSComponent("_part.x101")
glyph.layers[0].components.append(component)

Yes, understood.
Thank u.:slight_smile: