Cannot get ops to work for graph editor.


You’ll need to talk to me like a baby, as I’m brand-new to Python and relatively new to coding.

I’m trying to control the graph editor from Python script.

I see in Blender, at the top of the screen, in the area that reports my code, something like this: bpy.ops.graph.select_all_toggle(invert=False) and other such things. But when I type these codes exactly into the Python editor, I get context errors. For instance:

Traceback (most recent call last):
File “<blender_console>”, line 1, in <module>
File “/Applications/Blender/”, line 188, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.graph.copy.poll() failed, context is incorrect

In fact, a whole page of things I am supposed to be able to do to control the graph editor give the same error.

On the other hand, when I run something like “>>> bpy.ops.object.delete()”, that ops works perfectly.

One page I ran across says I have to “register” my ops, but I don’t know what that means or how to do it. Will this solve the problem?

Thank you so much for sharing your help and your expertise!

  • ianalexh

Cool - thanks!

Too bad we have to switch over to the Graph Editor for Blender to understand it… this might be something I’ll pass on to the developers…

Anyway, it works for now, so thanks a bunch!

  • ianalexh

this is due to the fundamental design concept of blender, nothing the will be fixed. You either need to change area.type or use an override. In this case, i would recommend the override.