I want to import an external function from a file, and not convert it to a module (we have hundreds of files for each function, so treating all of them as modules is too complicated).
Here is an explanation of the code. Please note that I have additional logic in the import function, for example, adding the root of the scripts folder and checking for the existence of the file and a special throw error to avoid duplication of code in every script that requires such an import.
C: \ Repository \ Foo.ps1:
Function Foo { Write-Host 'Hello world!' }
C: \ InvocationTest.ps1:
# Wrapper func Function Import-Function ($Name) {
Is there any trick to calculate the source in the global area?
source share