Copy and paste the following into a new Powershell ISE script and hit F5:
workflow workflow1{
\"in workflow1\"
func1
}
function func1 {
\"in func
Think of Workflows as short-sighted programming elements.
A Workflow cannot see beyond what's immediately available in the scope. So nested functions are not working with a single workflow, because it cannot see them.
The fix is to nest workflows along with nested functions. Such as this:
workflow workflow1
{
function func1
{
"in func1"
workflow workflow2
{
function func2
{
"in func2"
}
func2
}
"in workflow2"
workflow2
}
"in workflow1"
func1
}
workflow1
Then it sees the nested functions:
in workflow1
in func1
in workflow2
in func2
More about it here