Easy way to call python func in settings via a button?

hey, I'm kind of a noob in html/js and new in python :see_no_evil:
I don't need to pass parameters only call the funcition
is there a better way than SimpleApiPlugin ?
thanks

To get from the frontend to the backend it has to go through the API, so SimpleApiPlugin mixin is the way.

do you may have a simple example of the html/js part?
thx btw

You can use OctoPrint.SimpleApiCommand in JavaScript.

https://docs.octoprint.org/en/master/jsclientlib/base.html#OctoPrintClient.simpleApiCommand

Many many plugin do this, it is worth scrolling through the plugin repository to find some examples of stuff similar to what you want to do - there's a lot of choice.

1 Like