GSInstance.font is not a font when generating from project file

I have a script that runs on the DOCUMENTEXPORTED callback.

When generating from a .glyphsproject file, the extracted GSInstance’s font attribute from the info object is not the GSFont, but a GSProjectDocument. Accessing the font fails, of course:

font_inst = info.object()["instance"]
# ...
if full_key in font_inst.font.customParameters:
AttributeError: 'NSKVONotifying_GSProjectDocument' object has no attribute 'customParameters'

I think it is just an oversight in the Python wrapper. (I guess .font is really something like GSInstance.parent, which gets the wrong object in this case.) Is there a way to work around this?

I’ll fix this in the wrapper.