Hi, it seems as a button created in a plot with several layers can only be activated from the same layer in which is was created(Orig.5). Is there any way to get away from this and have a "universal" button, available from all layers in a plot?
Any Text Object (and all buttons start as Text Objects) is associated with the Layer in which it was created - even if its attachment property is set to Page. By creating a button on a Graph, you will necessarily activate the layer the button is in when you use it. Conversely, if you activate this button through script, you will need to activate the layer before you can call its 'click' method.
The solution in this case is not to use a button at all. You should create a menu item. When the menu is activated, your script will run with the current layer still active.
Origin Professional users have the additional option of creating floating toolbars - like the Linear Fit tool - that similarly have no connection to any layer, and can be used with all layers.