What's the event here?
since I do not immediately have an answer, perhaps I am not going about this the
How are you launching this script?
This is being used with an Acrobutton (button on the add-on tools bar).
triggers the function.
You can try passing the event as an argument to the function. Not sure if it
will work, though.