Determine how script was ran

How can I determine if a script is being run by pressing Alt-P or through a linked script (like on FrameChanged)? Basically I want to display a GUI if the script was started manually, but not if it was triggered by an event.

blender.bylink ?

You can write on the bf-python list to ask for a function to do this .

I tried this once too… with the subsurfacescattering script. so here a very bad… awefull coded and buggy, “not in every case”-working solution:

#if object[0].getScriptLinks("FrameChanged")[0]:
#   button_event(3)
#   Draw.Register(gui, event, button_event)

if I knew how to get the filename of the script you could expand it to get it working. like
if object[0].getScriptLinks(“FrameChanged”)[0] == “filename of my script”: