Please, try to refrain from profanity here, it’s a forum rule.
Without your file, it’s difficult to say what is going wrong. However, it might be that you’re trying to add an object in a different scene, which although valid, does throw this error. You can work around it by referencing the object from the scene’s inactive objects list.
The object is in the same scene, a single armature modifier (armature is in layer 1 which is active but I also tried to put the armature in other layer with the same result).
The object that needs to be added is in every aspect exactly like a newly created cube.
Its in the same scene as the cube, in the same layer as the cube.
Uploading the blend file is not an option at this point; I would have to make a new one just to give an example and who knows if it’ll happen the same
We usually advise creating a small, simple demonstration of the issue. This quickly helps you to identify if it is something you’re doing wrong, and if not immediately obvious, allows us to quickly reproduce the issue.
I tried making a new blend file just to address the issue.I only get the error when I attempt to add the human model, not a cube, not a circle, not a cone, just the human model.
For future reference, you can upload files in your post, which saves the hassle of going through download sites
Also, don’t call scripts “test.py”, as it shadows the test module in the Python standard library, so it often fails to run on some computers.
If you write “print(own.children)” in your module, you’ll notice that the cube has a child object. This child (the armature) is in the active layer, hence the script throws an error. I’m not sure why you’re doing that, but the error is to be expected.
I had similar problem with my BGMC script for doors. It was different, of course, but it appears so latest blender has some problems out there with stuff like that…
Imagine I have a gazillion models that use the same armature, it’ll be less than ideal to have them all hidden in an active layer. Instead, my idea is to have them in an inactive layer and add them as needed.
It’s better to use a dummy mesh patented to your armature and the use switch mesh. Adding an object which has children to a scene also adds the children. This can cause problems elsewhere too.
Ok, I think I’ll just take the healthier approach and use replace mesh, I just hope the armature works for meshes with different weight painting when replaced.
Thanks everyone for the help.