Running an external Python script from within a Glyphs panel plugin?

I’ve been working on a small panel plugin that is just about exposing a few custom scripts quickly in the UI — I realize I can add custom shortcuts a few different ways, but this is a bit easier for this specific audience. I have the UI wired up using vanilla and buttons are all doing what they’re supposed to do but I can’t seem to figure out the right way to have one run a specific script from the Glyphs 3 > Scripts folder within the app.

I haven’t had any lucking finding clues within the forum so far or by trying to dissect other plugins so wondering if someone has a suggestion. FastScripts is one that could do this but unfortuntely I need something proprietary in this case.

class clientActions (PalettePlugin):

  @objc.python_method
  def settings(self):
    self.name = 'Client Actions'
    ...
    self.buildButton = Button(("auto"), "Export Font", sizeStyle="small", callback=self.buildCallback)
  ...
  self.dialog = self.paletteView.frame.getNSView()

  ...
  @objc.python_method
  def buildCallback(self, sender):
    Glyphs.showMacroWindow()
    print('clicked build button')
    # TRIGGER SPECIFIC SCRIPT HERE
   # SUCH AS "buildFontRelease.py"

There is a plugin that does something like this. Search in the Plugin Manager for “FastScripts”.

And it shows how to run a script: FastScripts/FastScripts.glyphsPalette/Contents/Resources/plugin.py at 63a6962ac33c788e1d5cd09a46b9f4570283c792 · ViktorRubenko/FastScripts · GitHub

Oh, thanks Georg. I’ll look more closely and try that. I didn’t see GSScriptingHandler at all in the Glyphs API docs which is maybe why I overlooked that. Is info on that missing from the docs?

Have a look at the top right corner of the web page. There you find a “Core” button. It leads to some documentation of the internal object model.