I have the following functions (these are simplified examples)
function a {return 2}
function b {$a=a; return $a+2}
function c {$a=a; return $a*10}
When I run the following codes
Start-Job -ScriptBlock $Function:b -Name "test"
Receive-Job -Name "test"
It shows me this error:
The term 'a' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Any idea on how to start a function as a job while that function calls another function? Each function needs to be used independently as well (explained in Edit 1). In short, I need to be able to run function c
(as a job) too.
Edit 1: Here provides a solution but if I do so, I can not run functions independently. It is almost the same solution provided by @TheIncorrigible1.