How to use Python scripts to call the offset curve function in glyphs?

How to use Python scripts to call the offset curve function in glyphs?
屏幕快照 2023-05-29 15.17.00

I can’t remember who wrote this snippet, probably mekkablue, but it’s what I use in my scrippt for building math symbols:

offsetFilter = NSClassFromString("GlyphsFilterOffsetCurve")
offsetFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_metrics_error_shadow_capStyleStart_capStyleEnd_keepCompatibleOutlines_(
			layer,
			-10,  -10, # horizontal and vertical offset
			True,     # if True, creates a stroke
			False,     # if True, distorts resulting shape to vertical metrics
			0.5,       # stroke distribution to the left and right, 0.5 = middle
			None, None, None, 0, 0, True
)

Where layer is the layer you want to apply the filter to.
There may be a simpler method name these days but I don’t know

Thanks very much !!!

How is it called in glyphs2?

Inglyphs2,offsetFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_metrics_error_shadow_capStyle_keepCompatibleOutlines_?How to provide parameters?

‘’‘offsetFilter.offsetLayer_offsetX_offsetY_makeStroke_autoStroke_position_metrics_error_shadow_capStyle_keepCompatibleOutlines_(Layer, 10, 10, True, False, 0.5, None, None, None, 0, True)’‘’
Error reported in glyphs2:Traceback (most recent call last):
File “”, line 4, in
TypeError: depythonifying struct, got no sequence

Please refrain from posting multiple responses one after the other in the same thread. If someone knows the answer to your question, they will post a reply.