The function append does not work in G3

The following script does not work right in G3, but it works right in G2.
I found the function append does not work sometimes, that’s why the xPaths is empty.
but , I don’t know where is wrong?

import copy
from Foundation import NSMakeRect, NSIntersectsRect

xPaths = []

pLayer = Glyphs.font.glyphs["space"].layers[0]
checkRect =  NSMakeRect(0, 350, 300, 300)
for p in aLayer.paths:
	if NSIntersectsRect(checkRect, p.bounds):

test.glyphs (6.8 KB)

Please help to find the reason.

Use layer.shapes instead of layer.paths: Python Scripting API Documentation — Python Scripting API 3.0 documentation

I think you script has a typo: you assign pLayer and then access aLayer. That might be available from another script.

Yes, the ‘aLayer’ should be ‘pLayer’.
and use shapes is correct now.:slight_smile:
Thanks a lot.