Print Head Commands from Python

Hi,
I am developing my own plugin. I am trying to find a way to issue gcode commands to move the print head from python. Say in "on_api_command" function in init.py I want to move head 1mm in z direction.

I know it is possible from the javascript side with OctoPrint.control.sendGcode(); but I am looking for an equivalent in back-end side.

Can you please help?

Thanks

self._printer.commands(["list", "of", "commands", "to", "send"]) is what you want.

You can view all the injected properties and the specific API documentation as well for the PrinterInterface.

1 Like