title: How to import only functions from .R file without executing the whole file
body: <p>Let's say I have a R script, testScript.R</p>
  
  <pre><code>test &lt;- function(){cat('Hello world')}
  cat('Bye world')
  </code></pre>
  
  <p>In the R-console, I understand I can import the function, <code>test()</code> by </p>
  
  <pre><code>source('testScript.R')
  </code></pre>
  
  <p>However at the same time, it will also execute <code>cat('Bye world')</code>. Assuming it is not allowed to create/modify files, is there a way to import only the function, <code>test()</code> without executing <code>cat('Bye world')</code>?</p>