Reputation: 3965
I am trying to call a function in a PowerShell script in the same directory. However, when I call it, I get this error:
The term 'functionName' is not recognized as the name of a cmdlet, function, script...
Any idea why this occurs? I also tried dot loading the script first like this before calling the function:
.\Script.psm1
Upvotes: 0
Views: 444
Reputation: 200523
.\Script.psm1
would run the script (script module, actually) in a child context. To be able to use functions from it in the current context you need to run/load it in the current context. That can be done via dot-sourcing for regular scripts, or via Import-Module
(for modules).
Upvotes: 2