Well yeah, that should be a given. But I already figured that part out so it shouldn’t need to be explained,should it? I could have detailed more, like the fact that the object the camera is parented to will move around, that I will be switching to and from that camera to others, that the camera will hold properties, etc. Are you saying all that matters too?
I just gave you the problem broken down to just what I need. I left that other code in there to show exactly what I had so far.
Your code doesn’t work, btw.
I found the solution somewhere else, and it appears to work fine. Do you see any problems with it?
#Add new camera to scene
bpy.ops.object.camera_add(location=(0.885581, 0, 2.01546), rotation=(1.5708, -0, 1.5708))
#Assign a name to the camera
bpy.context.object.name = “Enemy Camera”
a = bpy.data.objects[‘Cube’]
b = bpy.data.objects[‘Enemy Camera’]
bpy.ops.object.select_all(action=‘DESELECT’) #deselect all object
a.select = True
b.select = True #select the object for the ‘parenting’
bpy.context.scene.objects.active = a #the active object will be the parent of all selected object
#Now The parent of b is a