I've got a module setup to be like a library for a few other scripts. I can't figure out how to get a class declaration into the script scope calling Import-Module
. I tried to arrange Export-Module
with a -class
argument, like the -function
, but there isn't a -class
available. Do I just have to declare the class in every script?
The setup:
import-module holidays
Here is what the class looks like:
Class data_block
{
$array
$rows
$cols
data_block($a, $r, $c)
{
$this.array = $a
$this.rows = $r
$this.cols = $c
}
}
According to here and here, you can use classes defined in your module by doing the following in PowerShell 5:
using module holidays