How to import script libraries used in Glyph

Hello, this is somewhat of an offtopic question, sorry. I am desperately trying to import a library from an installed script. The script is, of course, in the scripts folder. Is there any way to write an import in another script? Specifically, I am trying to import HT_LetterSpacer_script.py.

For some reason, when I first start Glyphs, from HT_LetterSpacer_script import doesn’t work – “module not found”. After I run the script from the scripts panel once, the import works fine, though.

I have tried importing using the explicit filepath (using imp), but that is unable to deal with ~/, so it is rather useless if I want somebody other than User/sebastiancarewe/ to be able to use my script :wink:

Any help is much appreciated, thanks!

Can’t you expand the ~ before you feed it int imp?

That’s what I was looking for. Thanks a lot!

For the Application Support folder, you can also use the following snippet:

GSGlyphsInfo.applicationSupportPath()

Ah, great! Good to know. Thanks. I will use that in the future :slight_smile: