I created a script named s.ps1 to define a function named s1.
But, after I run this script, the s1 function is not available in the global scope like:
s1' is not recognized as a cmdlet, function, operable program, or script file.
There are two ways to add the function name to the global scope.
1) Using the dot sourcing
. .\s.ps1 # be cautious that there are a space between two dots.
This makes all definitions in the script be exported or copied to the global scope after its execution.
2) Using global: keyword as follows: