Reputation: 347
Environment:
Name Value
---- -----
PSVersion 7.1.0
PSEdition Core
GitCommitId 7.1.0
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Code:
#testmodule1.psm1
Class TestClass1
{
}
#testmodule2.psm1
Class TestClass2
{
}
Then in command line:
PS C:\data\cwd> [testclass1]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False TestClass1 System.Object
PS C:\data\cwd> using module testmodule2
PS C:\data\cwd> [testclass2]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False TestClass2 System.Object
PS C:\data\cwd> [testclass1]
InvalidOperation: Unable to find type [testclass1].
It seems with the load of the 2nd module the classes in the first module was clear out from the memory Can you please advise?
Upvotes: 1
Views: 55
Reputation: 187
use this like a SINGLE command using module '$SomePath\testmodule1.psm1'; using module '$SomePath\testmodule2.psm1'
else directive Using module $SomePath\testmodule1.psm1 Replace to $SomePath\testmodule2.psm1
Upvotes: 1