How can a parameter be passed from one operator to another? I used a python template to create a menu which is populated by the names of files from the text editor:

class AnimMenu(bpy.types.Menu):
    bl_label = "Anim Menu"
    bl_idname = "OBJECT_MT_anim_menu"

    def draw(self, context):
        layout = self.layout
        for txt in bpy.data.texts:
            if txt.name[-4:] =='.txt':
                layout.operator("object.anim_operator", text=txt.name).text_name = txt.name # from here


Another operator should receive the filename as a parameter 

class AnimOperator(bpy.types.Operator):
    bl_idname = "object.anim_operator"
    bl_label = "Pose Anim Operator"

    text_name = bpy.props.StringProperty(name="anim_text_name") # to there

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        txt = bpy.data.texts[ text ].as_string()
        main(context, text_name)
        return {'FINISHED'}


I wasn't able to use this technique:
How to set multiple custom attributes to operator class when called in UI layout?

props = layout.operator("object.anim_operator", text=txt.name)
props.text_name = txt.name


leads to:

AttributeError: 'OBJECT_OT_anim_operator' object has no attribute 'text_name'
I had to add the self keyword to access the variable in the invoked operator (basic python, ouch!)

class AnimOperator(bpy.types.Operator):
    bl_idname = "object.anim_operator"
    bl_label = "Pose Anim Operator"

    text_name = bpy.props.StringProperty(name="anim_text_name")
    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        print("invoked script name=%s" % self.text_name ) # &lt;&lt;- self.