Appending cameras to scene


I’m struggling a little with a task of appending cameras to scene from A to B. > Code

        link = False     
        newCameras = []
        print("Adding new cams")
        with, link=link) as (data_from, data_to):
            for camera in data_from.cameras:
            data_to.cameras = newCameras
        for camera in newCameras:

I get:
TypeError: error with argument 1, "object" -  Function.object expected a Object type, not Camera

Any help would be great.
Thanks !

In Blender camera’s meshes, lights etc are object-data, not objects you can link to a collection.

You’ll need to either create a new camera object and link the camera to it or link in the camera objects (which will load the camera data too).


Yeah thanks, it was quite “fun” issue… I’m still confused by some decisions of blender api but o well… here is working code>

        newCameras = []
        camNames = []
        with, link=link) as (data_from, data_to):
            for camera in data_from.cameras:
            for cameraName in data_from.objects:
                if cameraName in camNames:

            data_to.cameras = camNames
            data_to.objects = newCameras

        for cam in newCameras: