diff --git a/klippy/klippy.py b/klippy/klippy.py index 678c0980..6a24d4a3 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -58,8 +58,9 @@ class Printer: self.run_result = None self.event_handlers = {} self.objects = collections.OrderedDict() - self.objects['webhooks'] = webhooks.WebHooks(self) - gcode.add_early_printer_objects(self) + # Init printer components that must be setup prior to config + for m in [webhooks, gcode]: + m.add_early_printer_objects(self) def get_start_args(self): return self.start_args def get_reactor(self): diff --git a/klippy/webhooks.py b/klippy/webhooks.py index 8be225a4..1c3645be 100644 --- a/klippy/webhooks.py +++ b/klippy/webhooks.py @@ -268,3 +268,6 @@ class WebHooks: logging.info(msg) raise WebRequestError(msg) return cb + +def add_early_printer_objects(printer): + printer.add_object('webhooks', WebHooks(printer))