You just need to add
keyable=True to your call to cmds.addAttr(). If you don’t, then it won’t appear in the channel box, but you can still find it in the attribute editor under the “extra attributes” dropdown.
keyable keyword specifically determines whether the attribute should appear in the channel box or not. Also FYI, that is all that it does. It does not actually make the attribute un-keyable, it just means that it won’t be keyed when you press the ‘s’ key to key all. You can still right-click it in the attribute editor under “extra attributes” and set a key that way.
There is a
hidden keyword to cmds.addAttr, but it is basically useless. You can’t actually prevent an attribute from having keys set unless you lock it (
This is a little bit annoying because of the way this stuff is named