I have a custom Maya plugin node with an MFnNumericAttribute attribute. However, the attribute value keeps changing to a new value every time the plugin is reloaded
is there a reason why you set the data to 123 in the post constructor insteaf of using a default value?
the post constructor only gets called when the node is created not when its loaded from file (as far as i know)
there might be an issue with your node not having its attribute writable, which might break part of your setup as it does not know that its an input plug or how it affects that outcome of your plugin
is the idAttr an mobject that is static persistent? it might be that the mobject order gets changed on load if you dont do that and it gets arbitrary data added in.
Is there a reason you need to generate the unique id through the c++ node? It seems to me like you are trying to do something that is not possible or just in a very roundabout way.
If you make the id writable and storable with a default of 0, check in the init if the value is 0 → assign a unique id. If it has a different value, keep it as is. Get it working with the usual steps and after that you can check if you can make writeable False.