Skip to content

MLC128: Scene subclass init never calls super().init()

qual reports MLC128 when a project Scene subclass defines __init__ and super().__init__() is called on no path. Scene.__init__ prepares the renderer, camera, and file writer (DESIGN §3.1); skipping it leaves the scene unable to render.

  • Default severity: error
  • Minimum confidence: high
  • Implementation phase: 2
  • Fix: none

The rule never fires when the MRO cannot be linearized (unresolved or dynamic bases), when super() is called on some paths only (Maybe), when a legacy super(Class, self).__init__() or direct Base.__init__(self, ...) call appears, or when __init__ delegates into another project-defined method that could perform the initialization. Mobject subclasses are not checked yet (no interpreter fact for their constructor chains).

Wrong

class Bad(Scene):
    def __init__(self):
        self.section = 2  # Scene.__init__ never runs
class Good(Scene):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.section = 2