title: Dot-sourcing a script without executing it
body: <p>Is it possible in Powershell to dot-source or re-use somehow script functions without it being executed? I'm trying to reuse the functions of a script, without executing the script itself.  I could factor out the functions into a functions only file but I'm trying to avoid doing that.</p>
  
  <p><br>
  <strong>Example dot-sourced file:</strong> 
  <br></p>
  
  <pre><code>function doA
  {
      Write-Host "DoAMethod"
  }
  
  Write-Host "reuseme.ps1 main."
  </code></pre>
  
  <p><strong>Example consuming file:</strong> </p>
  
  <pre><code>. ".\reuseme.ps1"
  
  Write-Host "consume.ps1 main."
  doA
  </code></pre>
  
  <p><strong>Execution results:</strong></p>
  
  <pre><code>reuseme.ps1 main.
  consume.ps1 main.
  DoAMethod
  </code></pre>
  
  <p><strong>Desired result:</strong></p>
  
  <pre><code>consume.ps1 main.
  DoAMethod
  </code></pre>