I’m new to Blender. I’m trying add a background image to my scene in Python script. It runs without errors, but I can’t see the background image.
Can someone please look at my code below and tell me what I’m doing wrong? (It may be that my camera is not active, but I’m not sure how to activate it.) Thank you very much in advance!
###########################
import bpy
filepath = r"C: est rees.jpg"
img = bpy.data.images.load(filepath)
for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
pace_data = area.spaces.active
bg = space_data.background_images.new()
bg.image = img
break
cam = bpy.data.cameras.new(“Camera”)
cam_ob = bpy.data.objects.new(“Camera”, cam)
bpy.context.scene.camera = cam_ob
bpy.context.scene.objects.link(cam_ob)
bpy.context.scene.objects.active = bpy.context.scene.objects[“Camera”]
#########################################