Sending GCODE to the printer from a plugin

I might be super blind here, but I can't seem to find documentation on how to send a GCODE command to the printer from an OctoPrint plugin? There are a lot of posts about using the octoprint.comm.protocol.gcode hooks, but that only seems to allow me to intercept GCODE & get alerted, but just sending a plain string of GCODE like from the terminal in the client, just backend?

You can use self._printer.commands():
https://docs.octoprint.org/en/master/plugins/injectedproperties.html (for self._printer)
https://docs.octoprint.org/en/master/modules/printer.html#octoprint.printer.PrinterInterface.commands

2 Likes

Thank you... I knew it was an obvious answer :slight_smile: