ImportError: No module named Blender

5.6k Views Asked by At

I worked with Blender 2.49 and in my script I used from Blender import *. But now I'm upgrading my code to Blender 2.74 and when I run appears this error No module named Blender. There have been changes to call Blender module in version 2.74?

2

There are 2 best solutions below

2
On

From 2.50 blender started using python 3.x and the python api was completely changed. From 2.63 bmesh (supporting n-gons) was added which changed the way mesh editing was done.

You may want to start with some python 2 to 3 docs as some parts of your script may need changes to work in python 3.x.

You can find the new api reference online and I would suggest you start with the quickstart and overview listed on that page, maybe even experiment with the sample script templates that you can find in blender's text editor.

Once you have an idea of the new python api take a go at re-doing your script. You will also find better help for blender specific python scripting at blender.stackexchange.com

0
On

Try

import bpy 

You can find the Blender 2.74 API documentation here:

https://docs.blender.org/api/blender_python_api_2_74_0/info_quickstart.html