Rather than defining all of your functions in a single .psm1
PowerShell script module file, you might want to break apart your function into individual files. You can then dot-source these files from your script module file, which in essence, treats them as if they were part of the .psm1
file itself.
Consider this module directory structure:
\MyCoolModule
\Functions
Function1.ps1
Function2.ps1
Function3.ps1
MyCoolModule.psd1
MyCoolModule.psm1
Inside your MyCoolModule.psm1
file, you could insert the following code:
Get-ChildItem -Path $PSScriptRoot\Functions |
ForEach-Object -Process { . $PSItem.FullName }
This would dot-source the individual function files into the .psm1
module file.