LoadAndRunAction is useful and I have used it in the past.
How do I get the action from one script into another without having it in the workflow?
I don't want to count on using the action from another script.
I want to copy the action into my current script. Call it if the action is required.
I'm not sure what you mean by 'without having it in the workflow'.
Using LoadAndRunAction allows you to consume an eternal action without creating an explicit link - it doesn't show up anywhere and will only be invoked if/when you execute that function.
The only catch is that the main action (test) that contains the LoadAndRunAction funciton also needs to contain the functions and objects that the called action requires.
What I am about to describe happens all within the same script.
From my main action(call it A), I call a copy of existing action B. Then I delete action B from the workflow. I also delete the call from action A.
I usually have to try this a few times until I get the right pattern.
I go to resources. I see that the action is available. I also see that it is not in the workflow.
I have the action B in storage in case I decide to use it later. The workflow does not know it is available unless I make a call to it from code.
When I do call it from code, it does not show up in the workflow. I like it because it does the action from the point that it is called. It does not run again.
I would like to do this same trick with an action that I import from another script. I would like to have it in "storage" for when I want to use it. Also if I do make a call to it, it will run from the place that I call it. Not once more when it finishes the rest of the actions.