If I create a manifest module with nested modules, exported functions from all nested modules after the first do not appear in the list of available commands and don\'t trigger
I had this line in my .psd1 file
FunctionsToExport = 'FuncFromMainPsm1 FuncFromSecondPsm1'
which was what I inferred from the line generated by Powershell Tools for Visual Studio:
# Functions to export from this module
FunctionsToExport = '*'
This caused my Get-Module -ListAvailable
to show what looked like the right thing
Script 1.0 MyMModule FuncFromMainPsm1 FuncFromSecondPsm1
But when I called FuncFromSecondPsm1
I'd get "The term 'FuncFromSecondPsm1' is not recognized...".
So I changed my export line to
FunctionsToExport = @('FuncFromMainPsm1', 'FuncFromSecondPsm1')
And now it all works. I can call both functions after my module loads, whether via autoload or Import-Module
.
I have tried this with and without both ModuleList
and FileList
set. They make no difference.