Blender Studio
  • Films
  • Projects
  • Training
  • Characters
  • Tools
  • Blog
  • Join
  • BLENDER.ORG

    • Download

      Get the latest Blender, older versions, or experimental builds.

    • What's New

      Stay up-to-date with the new features in the latest Blender releases.

    LEARNING & RESOURCES

    • Blender Studio

      Access production assets and knowledge from the open movies.

    • Manual

      Documentation on the usage and features in Blender.

    DEVELOPMENT

    • Developers Blog

      Latest development updates, by Blender developers.

    • Documentation

      Guidelines, release notes and development docs.

    • Benchmark

      A platform to collect and share results of the Blender Benchmark.

    • Blender Conference

      The yearly event that brings the community together.

    DONATE

    • Development Fund

      Support core development with a monthly contribution.

    • One-time Donations

      Perform a single donation with more payment options available.

Training Highlights
Stylized Rendering with Brushstrokes
Geometry Nodes from Scratch
Procedural Shading Fundamentals
Stylized Character Workflow

Training types
Course Documentation Production Lesson Workshop

Training categories
Animation Geometry Nodes Lighting Rendering Rigging Shading
Film Highlights
Wing It!
2023
Charge
2022
Sprite Fright
2021
Spring
2019
Project Highlights
Project DogWalk
Interactive
Gold
Showcase
BCON24 Identity
Showcase
Fighting with Grease Pencil
Article
Course
Scripting for Artists
Blender Versions
Videos
  1. 01

    Introduction & copy-pasting

    Free
  2. 02

    Names & Objects

  3. 03

    Stuff on Lists

  4. 04

    Data Types

  5. 05

    Collections: Mass-Rename of Objects

  6. 06

    Blender Collections

    Free
  7. 07

    For vs. While

    Free
  8. 08

    Your Own Operator

    Free
  9. 09

    From Script to Add-on

    Free
  10. 10

    User Interfaces

    Free
  11. 11

    Custom Properties

    Free
  12. 12

    Asset Linking

    Free
  13. 13

    Roast my Add-on

    Free
  14. 14

    The Roast of Nature Clicker

    Free
  15. 15

    Modal Operators

    Free
  16. 16

    Readability & Understandability

Tech
  1. 01

    Updating F-Curves

  2. 02

    Render 10,000 OBJ files

  3. 03

    Mass-Rename Bones & Vertex Groups

  4. 04

    Rendering from 'all' angles

Login to view this content

Join Blender Studio for just €11.50/month and get instant access to all of our training and film assets!

Login Join Blender Studio
Sybren Stüvel
Sybren Stüvel Author
License CC-BY
Report Problem
Videos

Names & Objects

In this video we see how, in Python, names refer to objects. In this context, an "object" refers to a thing in Python, and not necessarily a Blender object in 3D space. Knowing how names refer to things in memory is an essential part of scripting (and not wearing out your fingers from all the typing).

  • Everything is an Object (in Python)
  • Names refer to Objects
  • Using Blender's Context
  • Digging through names & objects by dotting

The Slides

Slides are only visible to Blender Cloud susbcribers

Join to leave a comment.

14 comments
Christopher Mills
Christopher Mills
Feb. 28th, 2022

Very new to Blender scripting. TAB is your Python auto-complete friend. Others new to Blender's way may benefit from knowing this.

Steven Goodman
Steven Goodman
Aug. 6th, 2021

I disagree that monkey is definitely not named 'Steve'. I think it's 'Suzanne' ....

Simonetos The Greek
Simonetos The Greek
Sept. 27th, 2020

Very helpful videos but It would be really better if we had at least English subtitles!!! In a few parts I can't really understand what Mr. Sybren says... Subtitles would be really useful!!!

PlumpMath
PlumpMath
Feb. 3rd, 2018

Transcript please. (no subtitle)

Roland Gsell
Roland Gsell
Nov. 8th, 2017

Hi, thanks for the tutorial!

If I say:

steve = bpy.ops.mesh.primitive_circle_add()

steve will become the string {'FINISHED'}, which might be handy for error handling, but I expected it to be a reference to the created object.

If I want to immediately do something with steve, I can refer to the active object, but what if I want to just remember that specific object for later modifications, I could use these lines:

bpy.ops.mesh.primitive_circle_add()

steve = bpy.context.selected_objects[0]

However, I'd like to know if I could write that in just one line.

Sybren Stüvel
Sybren Stüvel
Nov. 9th, 2017

@Roland Gsell: the returned value of an operator will always be of this form, so you can't write what you want in one line. I would also suggest using steve = bpy.context.active_object instead of using selected_objects[0]. If later the active object changes, steve will still point to the circle object you added.

Show more replies
Roland Gsell
Roland Gsell
Nov. 9th, 2017

@Dr. Sybren: Thanks! The strange thing is that python autocompleted activ... to active_objects - so I thought there's no single object to work with.

Maybe that's sort of a zsh autocompletion and I'm more the bash-guy ;-) I can't try it out at the moment, my Blender is rendering some stuff...

I love the new version by the way. 100 samples with denoise looks much better than 500 with 2.78..

Takeshi Funahashi
Takeshi Funahashi
Sept. 4th, 2017

Hi thanks you offer script tutoriall. it is really useful to learn blender specific operations. then I have one question about context. in blender manuall, it say "all context values are readonly, but may be modified through the data api or by running operators"

but when I try to re-name, by bpy.context.active_object.name = "newmonkey" it could work in blender console. is it exceptional case? or if I can only change location.x etc by context?

Stephen Petersen
Stephen Petersen
Sept. 4th, 2017

@fun2tax: I did it in 2 lines.

a = bpy.context.active_object

a.name = "newmonkey"

Show more replies
Takeshi Funahashi
Takeshi Funahashi
Sept. 5th, 2017

@sybren: thanks now I seems understand , bpy.context read only meaning better. and Yes stephan, it actually work for me too. then I though it can be changed by context too.

Sybren Stüvel
Sybren Stüvel
Sept. 5th, 2017

@fun2tax: That remark only relates to the names in bpy.context themselves. For example, you cannot do bpy.context.active_object = some_ob to make some_ob the active object. Instead, you have to assign to bpy.context.scene.objects.active, since every scene has an active object.

You can still change the name of an object by assigning a value to its name attribute; the fact that that object happens to also be accessible through bpy.context.active_object does not all of a sudden make its name or location attributes read-only.

@Stefan59: it doesn't matter whether you do something in one or two lines. In your case, a is just another name for that particular object. It's the object itself that determines what you can do with it, not the name you assign to it.

Raj Arora
Raj Arora
Aug. 26th, 2017

The autoplay just repeats the first video over and over again. it doesn't go to the next one

Stephen Petersen
Stephen Petersen
Aug. 26th, 2017

@raj: never has

Adam Juhasz
Adam Juhasz
Aug. 23rd, 2017

Wow Sybren! I can't thank you enough! You have special talent for explaining this kind of stuff! I'm a recovering "script avoiding addict" I'm almost sure this course will cure me :D

Films Projects Training Blog Blender Studio for Teams
Pipeline and Tools
  • CloudRig
  • Blender Kitsu
  • Brushstroke Tools Add-on
  • Blender Studio Extensions
Characters
  • Mikassa
  • Whale
  • Ballan Wrasse
  • Snow
Studio
  • Terms & Conditions
  • Privacy Policy
  • Contact
  • Remixing Music
Blender Studio

The creators who share.

Artistic freedom starts with Blender The Free and Open Source 3D Creation Suite