You can use their plugin API.
https://developers.figma.com/docs/plugins/
This is what I use. Load a little shim plugin and control it with whatever you want. I made the plugin poll an http server that listens for commands.