0
$\begingroup$

I'd like to run the script here but hit an error on the 2nd line:

view_layer = bpy.context.view_layer
Traceback (most recent call last):
  File "/usr/lib/python3.6/code.py", line 91, in runcode
    exec(code, self.locals)
  File "<blender_console>", line 1, in <module>
AttributeError: 'Context' object has no attribute 'view_layer'

Autcompleting the bpy.context object does show there's no view_layer property...maybe the docs are outdated?

$\endgroup$
1
  • 1
    $\begingroup$ I would suggest to check which version of the API is used, as there is a possibility to search older as well as newer (beta version) API docs. If it's not for some special functionality change from 2.79, i would not see a reason to not update to 2.81. $\endgroup$ – Xylvier Nov 28 '19 at 15:32
1
$\begingroup$

The manual page you've linked is for Blender 2.81 and is up-to-date. If you're using an older version of Blender you'll have to consult the matching version of the manual. The documentation of bpy.types.Object in Blender 2.79 can be found here.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.