0

Please note: this is NOT the same question - mine is about how one does the same thing with python.

I am trying to use python to append cameras and lights from one .blend file to another, like this:

with bpy.data.libraries.load(os.path.abspath(camera_file), link=False) as (data_from, data_to):
    print("Importing cameras %s" % (", ").join(data_from.cameras))
    print("Importing light %s" % (", ").join(data_from.lights))
data_to.cameras = data_from.cameras
data_to.light   = data_from.lights

The lists of cameras and lights are output correctly but nothing seems to happen.

What am I doing wrong? I think I should probably import camera and light objects too as objects - but how do I do that?

simone
  • 745
  • 4
  • 14
  • Hello and welcome. Please don't post the same question more than once. If you feel your previous question was incorrectly marked as duplicate, or the linked posts don't adequately address your issue, go back to your previous question and edit by pressing the Edit button below, including information of what you have tried, why it failed and how the duplicates don't address your issue. Once edited the question is automatically queued up for review so it can be reopened. – Duarte Farrajota Ramos Mar 21 '22 at 13:17
  • Please read the proposed duplicate, you are making the same mistake. With Python or without you need to be linking objects, you are linking camera and light settings rather than objects. – Duarte Farrajota Ramos Mar 21 '22 at 13:20
  • 1
    @DuarteFarrajotaRamos - thanks, I'll do that later today or tomorrow. I did not know how to address the closing, and it came across as if you hadn't seen the python bit at all – simone Mar 21 '22 at 13:47
  • I did, but this is a common issue and it seemed likely this was your difficulty as well, rather than how to link objects. If that is not the issue feel free to edit your other question with an update so it can be reopened. – Duarte Farrajota Ramos Mar 21 '22 at 13:52

0 Answers0