BigWigs = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceDebug-2.0", "AceModuleCore-2.0", "AceConsole-2.0", "AceDB-2.0") BigWigsDebuggy = BigWigs:NewModule("Debuggy", "AceConsole-2.0", "AceEvent-2.0") function BigWigsDebuggy:OnInitialize() BigWigs:ToggleModuleActive("Debuggy", false) end function BigWigsDebuggy:OnEnable() self.prior, self.dis = nil, nil self:Print("OnEnable") self:RegisterEvent("PLAYER_TARGET_CHANGED") end function BigWigsDebuggy:OnDisable() self:Print("OnDisable") end function BigWigsDebuggy:PLAYER_TARGET_CHANGED() if self.dis then self:Print("I should be disabled now...") elseif self.prior then self:Print("OnDisable should get called now") self.core:ToggleModuleActive("Debuggy", false) self.dis = true else self.prior = true self:Print("Target changed") end end -- During load: "OnEnable" -- Change target >> "Target changed" -- Change target >> "OnDisable should get called now" -- Change target >> "I should be disabled now..." -- Change target >> "I should be disabled now..."