In brief
- Python Console runs commands when you press Return, and you can retrieve earlier commands from the history.
- bpy.context provides access to context-specific information, such as the current scene and selected objects.
- You can change the active object’s location through the Python Console.
- A point light can be added to the scene using an example from the Blender API documentation.
Blender’s Python Console can be used to inspect scene data and explore the Blender API by running short snippets. Examples in the Blender documentation show how to change the active object’s location, view selected objects, and add a new light to the scene. The steps below focus on using the Python Console for small, controlled operations.
What you’ll learn in this guide
As well as running commands, the Python Console offers command history and autocomplete. First, we’ll query the current context—that is, the active object and mode in Blender. Then we’ll edit the active object’s location, list selected objects, and create a new light object.
This approach is well suited to running small tests instead of writing a long script for every operation. Once a command works as expected, the Console history makes it easy to reuse. According to the Blender documentation, you can recall commands from the history with the up and down arrow keys, while pressing Tab on the command line brings up autocomplete.
Requirements and setup
These examples use Blender’s Python Console and bpy, the Blender Python API. The source documentation does not specify a particular Blender version, account requirements, minimum hardware specifications, or an installation method. For this reason, check the API behavior in the version you plan to use for these examples.
In the Console, press Return to run a command. As you type, pressing Tab displays autocomplete suggestions for available members. The Blender documentation also recommends running dir() to get familiar with the Console environment. The first example below queries the mode and active object in the current context:
bpy.context.mode
bpy.context.active_objectThe first line returns the current interaction mode, and the second returns the active object. The documentation specifically notes that an object should be selected in the 3D Viewport to get the expected results. If there is no active object, commands that access its properties won’t return the expected result, so make sure a suitable object is active in the scene before editing.
Step by step: Basic operations in the Console
1. Explore API members
You can use autocomplete to explore which properties are available in the Blender API. Type the following expression in the Console and press Tab to see suggestions for submodules, properties, and methods in bpy. The documentation explains that methods are distinguishable in suggestions by the parentheses at the end.
bpy.Inspecting the members of a variable or module lets you work from the available API rather than typing commands from memory. In the Console environment, bpy.context also has the shorthand C, and bpy.data has the shorthand D. You can begin by running dir() to inspect the general functions and variables defined in the environment.
2. Change the active object’s location
You can access the active object through the context. The documentation includes examples of changing an object’s X coordinate and adding a small increment to it. First, query the object’s current coordinate; then use the command below to move it 0.5 units along the X axis:
bpy.context.object.location.x += 0.5This command modifies the active object’s location property. If no object is selected, bpy.context.object may not return a suitable object. So it’s important to confirm that an active object exists before running the command. Pressing the up arrow recalls the previous command from history, but it does not undo a change made to the scene. Check the active object and the result in the scene before trying a different coordinate.
3. Set all three coordinates at once
You can assign the three components of a location at once by providing the coordinates as a tuple. The example below sets the X, Y, and Z values to 1, 2, and 3, respectively:
bpy.context.object.location = (1, 2, 3)It’s also possible to change only the X and Y components. This can be used when you want to set both coordinates while keeping the current Z value:
bpy.context.object.location.xy = (1, 2)These examples access the active object’s location directly. Keeping track of which object is active in a scene helps prevent changing the wrong one. Trying an operation on a single object first and checking the result in the scene is a cautious way to work before moving on to more extensive operations.
4. View selected objects
When multiple objects are selected, bpy.context.selected_objects returns a list of selected objects. To see the selected objects other than the active object, you can use this expression:
[obj for obj in bpy.context.selected_objects if obj != bpy.context.object]This example iterates through the selected objects and adds those that are not the active object to the results list. This lets you inspect the difference between the active object and the other selected objects in the Console. bpy.context provides access to context information such as the current scene, selected objects, and current mode; bpy.data provides access to data in the blend file regardless of whether it is selected or active.
5. Add a point light to the scene
The example in the Blender API documentation creates a new light datablock and an object that uses it, then links the object to the active collection. It then sets the light’s location and selects the object, making it active. The code below follows the basic point-light example in the documentation:
import bpy
view_layer = bpy.context.view_layer
light_data = bpy.data.lights.new(name="New Light", type='POINT')
light_object = bpy.data.objects.new(name="New Light", object_data=light_data)
view_layer.active_layer_collection.collection.objects.link(light_object)
light_object.location = (5.0, 5.0, 5.0)
light_object.select_set(True)
view_layer.objects.active = light_objectThe code first creates the light data, then adds an object linked to that data to the scene collection. Once the location has been set and the object selected, the new light becomes the active object. The documentation’s example demonstrates this sequence of creating an object, linking it to the scene, positioning it, and making it active.
Common issues
One of the most basic problems is trying to access object properties when there is no active object. Before using the location examples, check that an object is selected and active. Editing a different object is often caused by overlooking which object is active in the context.
Another common point of confusion is assuming that clearing the Console display also clears the command history. According to the Blender documentation, Clear All in the Console menu refreshes the display but does not erase the command history. You can recall previous and subsequent commands with the arrow keys. Shift+Return adds a command to the history without running it; press Return to execute it.
If you want to save short tests as a script, you can copy the entire history buffer to the clipboard using the Copy as Script shortcut mentioned in the documentation. You can then paste it into a text file and use it as a Python script. Reviewing the code and its effects in the scene before moving on to a larger task helps prevent test commands from accidentally making their way into a production file.
Use in architecture and visualization workflows
In architecture, interior design, and archviz work, the Console can be useful for trying out small, repetitive operations, such as quickly changing the active object’s location, inspecting selected objects, or adding a light to the scene. Students and visualization artists who are just getting started with the Python API in Blender can use one-command tests to observe the relationship between context and object properties.
However, the examples here are introductory; the sources do not provide information about a specific project template, render settings, hardware requirements, or compatibility with other software. If you’re planning automation for an office workflow, test the examples with the Blender version you use and the object structure in your project. Checking the impact of commands on the scene and saving the history as a script when needed can help bring small tests into a more organized process.
Next steps
Start with commands that query the context, then try the location and selected-object examples separately. When you need to combine multiple commands, consult the Object example in the Blender API documentation and follow the sequence for creating a datablock, linking it to a collection, and making the object active. Operators also allow actions normally started by a button or menu to be called programmatically; consult the relevant API documentation to find the operator you need.
Sources and license
This guide was adapted from the “Python Console” page in the Blender Manual and the “Object” reference in the Blender Python API. Both sources are licensed under CC BY-SA 4.0; the content has been translated into Turkish and paraphrased, and the code examples are based on usage in the relevant API documentation.
Sources
2 sourcesSource texts are not republished; short quotes are marked, everything else is our own summary and commentary.
For architecture offices and students in Turkey, this guide’s practical value lies in the opportunity to learn by trying small edits in a Blender scene through the API. The examples for querying a selected object, changing its location, and adding a light provide a basic starting point before moving on to more extensive automation.
However, the sources provide no information about version compatibility, hardware requirements, or product costs. Before using these examples in production files, verify them in the Blender version you use and in the project scene; licensing, hardware, and workflow decisions also need to be evaluated separately.
Frequently asked questions
How do you run a command in the Blender Python Console?
Type the command on the Console line and press Return. Tab displays autocomplete, while the up and down arrow keys let you browse the command history.
How do you change the active object’s location in Blender with Python?
Access the active object through bpy.context.object and edit its location property. For example, you can use bpy.context.object.location.x += 0.5 to add 0.5 to the X coordinate.
Can you add a light to a Blender scene with the Python Console?
Yes. The example in the Blender Python API documentation creates a point-light datablock and object, links it to the active collection, positions it, and makes it active.



