I'm very used to Python where functions can be put in classes and called separately.
However, now I have to code something in PowerShell and I can't find a way if something similar would be possible here.
An example of what I'm trying to do:
function a {
Write-Host "a"
function a_1() { Write-Host "a_1" }
function a_2() { Write-Host "a_2" }
}
a # Works
a.a_1 # Doesn't works
a_2 # Doesn't works
function script:a_1() { ... }orfunction global:a_2() { ... }a_1anda_2are defined in the scope ofa, and thus cease to exist once the function returns. You can persist them in the calling scope by using the.dot-source invocation operator:. a; a_1; a_2