Editing an already imported module
Use the -Force
command with the Import-Module
and it will reload it.
Once a module has been imported, changes to it are not recognised since the module is loaded into memory. However, I've always been able to do a Remove-Module foo
, followed by an Import-Module foo
to load new functions.
All that said, your PSD1 file doesn't look right. It should have a ModuleToProcess
field set to 'MyModule.psm1'. Then when you do Import-Module MyModule
or Import-Module .\mymodule.psd1
, PowerShell will find & load the associated MyModule.psm1
file. I wonder if that is causing you to run afoul of some caching PowerShell does?
Below is the only solution that worked for me so far, in which you configure vscode to run a new session on each debug, I didnt find any other solution to work and debug Powershell classes.