It has to do with the way the files are ordered in the .toc (again)
We changed it to XML first so the .lua code could "see" AMD_TabOnCharacterFrame
Now, when it's created, you're asking AMD_TabOnCharacterFrame to call a function in your .lua (which hasn't been loaded yet)
Instead of using an OnLoad script in the XML just do whatever you were going to do to AMD_TabOnCharacterFrame in the .lua.
Lua Code:
hooksecurefunc("CharacterFrameTab_OnClick", function(self, button)
if self:GetID() == TabID then
ToggleCharacter("AMD_TabOnCharacterFrame")
end
end)
--[[
function AMD_OnLoad(self)
print("AddOn loaded")
end
]]--
-- Instead of the AMD_OnLoad function:
AMD_TabOnCharacterFrame_NextButton:SetText("OnLoad Change")
Depending on what the end goal is there might be a better alternative but this should work for now.