0

How do I use a variable in a module called from another script?

I've looked a long while for examples before asking this simple question. Every example I've found, including Microsoft's documentation only shows how to make a module and manifest and never an implementation. Because of this, I am unable to determine if I am just calling the variable wrong OR if I am unable to make an object reference in a module.

My functions are being called so the imports/exports are working as expected, and I am using a manifest to do so.

#
# Format-BLAH.psm1
#

$MyVar = New-Object MyClass($param)

# Functions declared below.
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
TacoMaster6000
  • 304
  • 3
  • 12

1 Answers1

1

You have to manually export variables:

Export-ModuleMember -Variable MyVar
briantist
  • 45,546
  • 6
  • 82
  • 127