Skip to main content
Share Your Experience: Take the 2024 Developer Survey
35 votes

How can I run blender from command line or a python script without opening a GUI?

All what Aldrik wrote, and more Blender Python API Tips and Tricks From official Blender documentation: For scripts that are not interactive it can end up being more efficient not to use Blenders ...
Ruslan L.'s user avatar
  • 511
32 votes
Accepted

How to use Keyframes and the Python API programmatically?

Figured it out! Here's how to use the Python API to set it: ...
Julian's user avatar
  • 601
23 votes

Install Addons in Headless Blender

Using python you can install an addon with bpy.ops.wm.addon_install(), you can then enable the addon with ...
sambler's user avatar
  • 55.4k
19 votes

How to open system console to get output from Blender on Mac OS 10?

Right click on the Blender icon in the Applications folder and select "Show Package contents". Make an alias of Contents/MacOS/Blender by right clicking and ...
user007's user avatar
  • 536
19 votes
Accepted

Rendering a cube as png file using Blender's Python API

Please invest time into researching about the Blender API and Python interface, before asking questions! ...
Leander's user avatar
  • 27.1k
17 votes
Accepted

Can you clear the System Console without restarting Blender?

Below is an example add-on that adds a button to the text editor for this purpose. Clearing the console is done with the platform specific commands cls for Windows ...
Robert Gützkow's user avatar
  • 25.7k
13 votes

Blender script run print to console

Override print method. Been investigating a number of ways to do this. Possibly the simplest is to override the print in your scripts. Below is designed to ...
batFINGER's user avatar
  • 84.5k
13 votes
Accepted

Rendering on command-line with GPU?

The following script allows you to enable all GPUs and optionally all CPUs as well. ...
Robert Gützkow's user avatar
  • 25.7k
13 votes

Can you clear the System Console without restarting Blender?

You can use os.system and call cls or clear: ...
HikariTW's user avatar
  • 7,841
12 votes

How to pass command line arguments to a Blender Python script?

thanks for the suggestions. I just managed to get a working example following the double-dash idea that retains all of argparse's functionality with minimal ...
fr_andres's user avatar
  • 521
11 votes

Is there anyway to make blender print errors in the UI?

If you do not want to restart Blender to see the messages sent to stdout or stderr, you can always run your script in blenders ...
Florian Franzen's user avatar
11 votes
Accepted

How to make Blender exit after running Python script from command line?

use bpy.ops.wm.quit_blender()?
Bruno's user avatar
  • 4,179
10 votes

How to render in command line?

Firstly open your Command Processor. Windows(Command Prompt) Linux(Terminal) Mac(Command Line). For Windows: In cmd first type ...
Yash's user avatar
  • 1,296
9 votes
Accepted

Install Addons in Headless Blender

You can just unzip the add-on into the /2.7x/scripts/addons/ directory. On Linux, it should be in the same directory as Blender. If there is more than just a single ...
Scott Milner's user avatar
  • 4,483
8 votes

How can I run blender from command line or a python script without opening a GUI?

For 2.79b ...
Ajay Rajawat's user avatar
8 votes

Why doesn't the Blender console go away when opening the program?

Same here, since a few days – due to a Windows 11 update, I think. Anyway, to start Blender without the console, you can run blender-launcher.exe. It's in the same ...
Sietse Brouwer's user avatar
7 votes
Accepted

Command line script renders without shaders

You're not actually rendering the 'simple.blend' file. You're actually rendering the default blend file. This is because the order of command line arguments matters. To explain further, your ...
Ray Mairlot's user avatar
  • 29.3k
7 votes

Can you clear the System Console without restarting Blender?

As of 2021, there is an operator for this. Clear command history only: bpy.ops.console.clear(scrollback=False, history=True) Clear command history and ...
Michael's user avatar
  • 171
7 votes
Accepted

Invalid drivers aren't shown and can't be deleted

Remove, since removed shape-key drivers. From pic in question appears they are shape key drivers, which remain if a keyblock is removed, renamed (To reproduce, add a shapekey "Key 1", give ...
batFINGER's user avatar
  • 84.5k
6 votes

What does "Invalid clnors in this fan!" mean?

Since I had the same message in the console with my processor going crazy, and I haven't found more information about that here, I answere this old question. In my case it was related to custom split ...
Mareck's user avatar
  • 1,964
6 votes
Accepted

Change value of material emission strength from Python console or script

Found a solution: bpy.data.materials['material_name'].node_tree.nodes["Emission"].inputs[1].default_value = 3 #or any other value Thanks to this reference
nest's user avatar
  • 203
6 votes

How to open system console to get output from Blender on Mac OS 10?

The only way to see the Blender console and thus the script output is to launch Blender from a terminal using the full path to the executable: ...
Bruno's user avatar
  • 4,179
6 votes

Environment variables specific to Blender? Do they exist?

...
Valery S.'s user avatar
  • 306
5 votes

How to force console window to show up automatically when Blender starts

Append -con to the command line arguments passed to blender.exe. You can do so by modifying the properties of your favorite ...
Ray's user avatar
  • 764
5 votes

How can I run blender from command line or a python script without opening a GUI?

you can also directly run expressions without having to create a new .py file like this: ...
cak3_lover's user avatar
5 votes

How do I import a fbx file into blender from command line?

You simply need one operator to import the FBX, and another operator to export the blendfile. Replace the filepath variables with the actual paths you want to use. ...
TLousky's user avatar
  • 16.1k
5 votes

Rendering on command-line with GPU?

After updating to Blender 3.1.0 the script that Robert posted stopped working for me and threw the error ...
Josh Bell's user avatar
5 votes

python script console command, poll() failed - context is incorrect

I converted your script over to use bmesh constructs. Note that matrix multiplication is not commutative, so $A \cdot B$ is not always equal to $B \cdot A$, and Python for some reason decided to use '@...
Ron Jensen's user avatar
  • 3,481
5 votes
Accepted

Is there any way to change the number of rendering samples using command-line?

There are several ways you can accomplish this. Probably the easiest is to have your command line include a python expression for Blender to execute. If you look at the manual entry for Command ...
Marty Fouts's user avatar
  • 33.2k
4 votes

Is there a way to batch render multiple scenes?

The answers above worked for me (on Windows 10) but only after I did some research. For those like me who have no idea how to take what is written above and make it work for your project, here is what ...
oneofmetwo's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible