error Window.Editmode

hi all,

i just started learning blender python, but 1 thing is going horribly wrong, while i see it being used in scripts here on the forum:

 
Import Blender
 
if Blender.Window.Editmode(): Blender.Window.Editmode(0)

it is supposed to turn of editmode if it is currently on, but blender answers this with:

TypeError: 'int' object is not calleble

could someone telle me what im doing wrong?

dreampainter

Try this:


import Blender

if Blender.Window.Editmode() == 1:
    Blender.Window.Editmode(0)

If the thing you’re checking in the if statement isn’t a bool, you should probably check its actual value (if value == 1 as I’ve done above) - what you’re doing should probably work when it’s an integer too (0 = false, 1 = true - this works in C++ certainly), but apparently not in this case :stuck_out_tongue:

Thanks for the fast reply.

tried it, but am still getting the same error

thanks anyway

dreampainter

EDIT:
i gave up, restarted blender and started anew.
works like a charm now.

thanks.