Using Properties with scripts

How do i access (get, set) the properties created in the logic panel from a python script. I’m sure this is noob question, please have patience with me.

Also has anyone done an in depth tutorial, course or book, on python and the blender api.

Don’t know if this helps, but I am a python noob and I am using http://www.zoo-logique.org/3D.Blender/scripts_python/API/ and http://wiki.blender.org/index.php/Scripts/Catalog alot. Found the presentation of structure and examples helpful.

If you mean how to access game properties from the Blender API, not via the game engine API, here’s an example. This gets info about a property called “testprop” on the active object and prints it to the console window:

import Blender

scn = Blender.Scene.getCurrent()
ob = scn.objects.active

prop = ob.getProperty("testprop")
print prop.name, prop.data, prop.type

Here are the relevant object functions to access properties, and here for the properties themselves.

Thanks, now if I want to change the value?

In you script Sanne just (prop.data = #) will set the property to what ever value i choose.

I think I’ve got it.

You’re welcome, avbsoftworks, glad I could help. :slight_smile: