Use Cycles rendering with all GPU OPTIX is used. # Setup CYCLE bpy.data.scenes[0].render.engine = "CYCLES" # Set the device_type bpy.context.preferences.addons["cycles"].preferences.compute_device_type = "OPTIX" # or "OPENCL" # Set the device and feature set bpy.context.scene.cycles.device = "GPU" bpy.context.scene.cycles.feature_set = "SUPPORTED" # get_devices() to let Blender detects GPU device bpy.context.preferences.addons["cycles"].preferences.get_devices() print(bpy.context.preferences.addons["cycles"].preferences.compute_device_type) for d in bpy.context.preferences.addons["cycles"].preferences.devices: if 'Intel' in d['name']: continue if 'CPU' in d['name']: continue d["use"] = 1 # Using all devices print(d["name"], d["use"]) Enable addons with BPY bpy.ops.preferences.addon_enable(module = 'sun_position')