What's Wrong with My Python Script? I'm trying to learn more about using the info window with Python. Turning it into an addon. I feel like I got pretty close, but it is giving me an error.

import bpy

class cubeMover():

    bpy.ops.transform.translate(value=(0, 2.86946, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)


def register():
    bpy.utils.register_class(cubeMover)

def unregister():
    bpy.utils.unregister_class(cubeMover)

if __name__ == "__main__":
    register()


When I run the code using just this it runs fine. 

import bpy
bpy.ops.transform.translate(value=(0, 2.86946, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)


But when I try and change it into an addon it doesn't work.
You should probably define an operator. See Python example files that come with Blender about how to write an operator:



It might be a good idea to change objects location directly instead of using an operator that is for user interaction. You can change the location of the active object by changing bpy.context.object.location values.