I have a simple module: varExp.psm1
$var1 = 20
Export-ModuleMember -Variable var1
And I import this module into PS session:
PS> Import-Module .\varExp.psm1
then
PS> $var1
20
But after I import it second time
PS> Import-Module .\varExp.psm1
PS> $var1
PS>
$var1 becomes null...
Anybody knows what is going on here? (PS2.0)
Edit: There are workarounds: Forcing reloading with Import-Module .\varExp.psm1 -Force, and testing if module was loaded before: if(-not (Get-Module varExp)) { Import-Module .\varExp.psm1 }. But I was hoping to get some reason behind $null value in simple case.