1

I have a module that I'm working on that only exports a few of its functions.

For testing, I sometimes want to execute unexported module functions (or read $script: variables, etc).

How can I do that (without exporting those functions)?

Disclaimer: I work for Microsoft.

citelao
  • 4,898
  • 2
  • 22
  • 36
  • Instead of using the `Import-Module` machinery, just dot-source the file instead (`. $filename`). – Maximilian Burszley Apr 15 '22 at 18:27
  • 1
    To run an unexported function: `& (Get-Module 'YourModule') { YourUnexportedFunction }`. I don't make this an answer as this has propably been answered before. – zett42 Apr 15 '22 at 18:44
  • Feel free to dupe this question if it has---I couldn't find anything when I did a search. @zett42 you sure you don't want to write that as an answer? – citelao Apr 15 '22 at 18:46

0 Answers0