r/PowerShell • u/samurai_ka • Dec 17 '25
Question Multiple files
Unfortunately, large PowerShell scripts cannot easily be distributed across multiple files in a project. What is your best strategy for this?
6
Upvotes
View all comments
Show parent comment
1
u/jdl_uk Dec 17 '25
There's 2 things here. Partially I mean that when I switched off autoloading my powershell start time went from 5-10s to 1-2s. I also mean that, in the same way that C# limits what you have available to what namespaces you reference, it's useful if your completions list is limited based on what you're using.
That's if you're using Import-Module, and yeah I've gone back and forth between those 2.
But you're still arguing I should take the option that has extra steps over the one that doesn't, every time I edit the module code. I'm not going to do that, even if you don't think the extra steps (even if it's only 1 step) matter.
That's a fair opinion and it's why I used to prefer modules over scripts - modules were the "Powershell way". I'm just dissatisfied with the developer experience.
Another thing that might be relevant is that most of the scripts I write are either used by developers (who'd rather just clone the repo and reference the file than install a module) or by CI/CD pipelines (where powershell norms don't always make sense).