How to install custom modules to Python 3.9.1(Glyphs)?

Hi,
Which would be the better way to install Python modules to Glyphs’ Python?

And another one (kindof related): Is there a way to run a script at app startup?

Many thanks,

Joancarles

There are several options. The easies would be to put a symlink to the module into the Scripts folder.

Or before you import the module in your script, add the location to sys.path.

Or install python from python.org (you only need to manually install pyobjc after installing it (pip3 install pyobjc)). Then you can install all plugins as you like.

1 Like

Symlink sounds the easier for me.
Any chance for running script(s) at startup?
(Thinking on the sys.path.append(…) for not-techie users of a shared scripts collection who might be scared of symlinking or installing Python themselves for avoiding to add it in every script using the module).

The other easy solution I’m thinking is to make the user run a script that creates the symlink into the “Scripts” folder.

Thanks again.

You can make a .glyphsplugin and do your setup there. But the order of execution is not guaranteed. So you need to check in all other plugins. But if you “only” need if for scripts, then is it fine.
Or add a module that has a function that runs the setup and you call it from all your scripts.

Will check the .glyphspluguin option too then. Though it seems to work running only once a setup script (that creates the symlink).
Thanks!