# Get an executable list of executed operators in python

What is it for: I’m writing an addon for blender which will have to store operators that have been executed since a custom button has been pressed, until another button is pressed.

What do I need: If possible I need the operators in a form like this:

bpy.ops.transform.translate(value=(0, 3.89135, 0), constraint_axis=(False, True, False), constraint_orientation=‘GLOBAL’, mirror=False, proportional=‘DISABLED’, proportional_edit_falloff=‘SMOOTH’, proportional_size=1)

In particular I need the Operator with it’s values.

Options I found:

The first option I found is bpy.context.window_manager.operators.

That gives a list of the operators, but not in a usable structure. It’s possible to convert them to the bpy.ops format, but there are around 2000 Operators in blender and I already stumbled across a lot of differences between the properties of an Operator which makes this option possible, but increadibly teadious and uneffective to implement.

The second option is the undo history, which has the problem that it’s not accessible to python. The third option is the info space, which draws all the operators that I need, but there’s no way that I know of to access them.

It would be great if you could help me find a solution to this!

Here's a solution I found. It’s not a nice one, but the best I could come up with:

context = bpy.context.area.type
bpy.context.area.type = “INFO”
bpy.ops.info.select_all_toggle()
bpy.ops.info.report_copy()
bpy.ops.info.select_all_toggle()
bpy.context.area.type = context
clipboard = bpy.context.window_manager.clipboard
clipboard = clipboard.splitlines()


So basically I’m changing the active context to the Info Space to then select everything and then copy it. The copied text is then split into lines, so you get a list with operators, that are formatted nicely.