Automatic import of Python functions in the Macro Panel?

Is it possible to have Glyphs import some Python modules or functions on launch that are then available in the Macro Panel?

This would be some separate configuration code that is automatically prepared when running code from the macro panel? What would be an example use case?

For example if I have a helper function called forAllFonts that calls a function on each open font.

def myFunction(font):


This could just save me typing the for font in Glyphs.fonts... loop every time I script something in the Macro Panel. But if I need to type the import statement every time instead, it doesn’t save a lot :wink:

I see. Definitely worth considering, but I cannot make any short-term promises.

Macro panel supports custom snippets.

What works already is that you can put a python file into the Scripting folder with your code in it. Then import that.

def testing():

macro panel:

from user import *
1 Like