You can do this in a number of ways depending on your use case. But I tend to like application events:
action X publish-event sub-system 798 type 1 arg1 FOO
event appl sub-system 798 type 1
action X puts $_application_data1 <== Prints FOO
I apologize that I missed your reply earlier. It seems like a cool way to pass control from one applet to another. Can you tell me where I can find documentation to "sub-system 798 type 1". Many advanced EEM scripts have some magic numbers. Is there a document that list all the sub-system or SNMP events that can be used in EEM?
You're right that these are magic numbers. Unfortunately, there isn't a list of all subsystems since the rest are internal to IOS. Subsystem 798 is reserved for "user defined" and type 1 is just a convention. You could have different types within 798 if you want different events. That is, consider 798 your user-defined namespace, and use as many types there as you want.