Usually, I use dot-sourcing to "import" my function defined in other script files.
But the Powershell Workflow does not allow dot-sourcing, and it can't recognize functions defined out of scope.
Is there any possible way instead of copy-pasting all the functions into the Workflow to invoke them?
For example:
# another_script.ps1
function FuncToBeCall {
# do something
}
# main.ps1
# Usual way I import the functions
. $PSScriptRoot\another.script.ps1
# I can invoke function here normally
FuncToBeCall
Workflow RunSomething
{
# do something...
# Want to invoke here, or in InlineScript/Sequence/Parallel
FuncToBeCall
}
RunSomething
PS. The reason I try to do it in the Workflow way is to take advantage of the Parallel
. Otherwise, I might do this in a normal way. Just looking for the best practice.