I moved a function (we’ll call it Get-MyFunction) from Module1 to Module2 (which I’ve never done before). If I run Get-Command Get-MyFunction, it fails to find the function, but it auto-loads Module1 (which was not already loaded). If I run Import-Module Module2, then run Get-Command Get-MyFunction, it is successful and finds it in Module2.
Everything with the function works as expected if I manually import the Module2 first, but some cache somewhere seems to think that it is still stored in Module1. I’ve confirmed there are no references in Module1’s module file or manifest file (including exported commands). What am I missing?
This is occurring on Windows Server 2019 (PSVersion 5.1.17763.503). I cannot recreate the problem on my Windows 10 1809 computer (PSVersion 5.1.17763.592).