title: PowerShell module design - Export-ModuleMember
body: <p>I am building a module that exports a cmdlet that I would like to make available through my profile. The implementation of this cmdlet is spread across multiple implementation files that contain implementation functions I don't want to make publicly available. So I use <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/export-modulemember" rel="nofollow noreferrer">Export-ModuleMember</a> to hide them.</p>
  <h3>File <em>get_something.psm1</em></h3>
  <pre><code>import-module .\get_something_impl.psm1
  
  function Get-Something {
      [cmdletbinding()]
      Get-SomethingImplementation
  }
  
  Export-ModuleMember -Function Get-Something
  </code></pre>
  <p>I then add <em>get_something.psm1</em> to my profile. By exporting only <em>Get-Something</em>, all of my implementation functions remain &quot;private&quot;.</p>
  <p>The issue I'm experiencing is that when using the <em>Export-ModuleMember</em> command, I have to import a module in my implementation files every time I need a function inside of it. For example, assume I have a module, person.psm1, with a function, <em>Get-Person</em>, that I need to call throughout all of my implementation files. Now I must import <em>person.psm1</em> in every single file that I need to call <em>Get-Person</em>. This is a result of using <em>Export-ModuleMember-Function</em> <em>Get-Something</em>. Without it, I would only need to import <em>person.psm1</em> once and it would be available.</p>
  <p>In essence, <em>Export-ModuleMember</em> is not only blocking my implementation to the outside. It's blocking it from my own implementation.</p>
  <p>Is this expected and considered a normal aspect of designing PowerShell modules?</p>