title: Robot Framework: Multiple Resource-Files accessing the same Library
body: <p>Hello to all RobotFramework users</p>
  
  <h1>Problem</h1>
  
  <p>We have many keywords at different levels of abstraction and are looking for a simple way to import them while maintaining support for autocompletion etc. in IDEs.</p>
  
  <p>The inheritance could look as follows:</p>
  
  <pre><code>   /---------------------&gt; basic_keywords.robot &lt;---\
    /                             ^                    \
   /                              |                    |
   |  advanced_keywords_1.robot --/            advanced_keywords_2.robot
   |            ^
   |            |
  more_advanced_keywords_1.robot
  </code></pre>
  
  <h1>Proposal 1: Import all keywords in <code>all_keywords.robot</code></h1>
  
  <p><code>all_keywords.robot</code>:</p>
  
  <pre><code>*** Settings ***
  Library     SomeLibrary.py
  Resource    basic_keywords.robot
  Resource    advanced_keywords_1.robot
  Resource    more_advanced_keywords_1.robot
  Resource    advanced_keywords_2.robot
  </code></pre>
  
  <p><code>more_advanced_keywords_1.robot</code>:</p>
  
  <pre><code># No Import of basic_keywords.robot here!!!
  *** Keywords ***
  My More Advanced Keyword
      Advanced Keyword   # from advanced_keywords.robot
      Basic Keyword      # from basic_keywords.robot
  </code></pre>
  
  <p>Import in test suites:</p>
  
  <pre><code>*** Settings ***
  Resource   all_keywords.robot
  </code></pre>
  
  <p>Benefits:</p>
  
  <ul>
  <li>This works at execution.</li>
  <li>With the same line in any of the test suites, we have access to all keywords.</li>
  <li>We do not need to import the necessary keywords in each of the advanced keywords files, which would lead to double imports. </li>
  </ul>
  
  <p>Drawbacks:</p>
  
  <ul>
  <li>Autocompletion etc. is not supported because <code>advanced_keywords.robot</code> does not know about <code>basic_keywords.robot</code>.</li>
  <li>Imports many (often not used) keywords in test suites, slows down performance (?)</li>
  </ul>
  
  <h1>Proposal 2: Reference <code>basic_keywords</code>... in <code>advanced_keywords</code></h1>
  
  <p>Proposed by @Todor</p>
  
  <p><code>advanced_keywords.robot</code>:</p>
  
  <pre><code>*** Settings ***
  Resource    basic_keywords.robot
  *** Keywords ***
  Advanced Keyword
      Basic Keyword      # from basic_keywords.robot
  </code></pre>
  
  <p><code>more_advanced_keywords_1.robot</code>:</p>
  
  <pre><code>Resource    advanced_keywords.robot
  # basic_keywords is imported here by advanced_keywords.robot
  *** Keywords ***
  My More Advanced Keyword
      Advanced Keyword   # from advanced_keywords.robot
      Basic Keyword      # from basic_keywords.robot
  </code></pre>
  
  <p>Double imports are handled by Robot Framework.</p>
  
  <p>Import in test suites:</p>
  
  <pre><code>*** Settings ***
  Resource   more_advanced_keywords_1.robot
  Resource   advanced_keywords_2.robot
  </code></pre>
  
  <p>Benefits:</p>
  
  <ul>
  <li>This works at execution</li>
  <li>Auto completion etc. is supported as the IDE knows where the <code>Advaned Keyword</code> is defined</li>
  <li>Better control on which keywords are available, faster</li>
  </ul>
  
  <p>Drawbacks:</p>
  
  <ul>
  <li>You have to explicitly decide / import which <code>advanced_keywords</code> you use in a test suite.</li>
  </ul>
  
  <p>Double instantiations of the library can be prevented by <code>ROBOT_LIBRARY_SCOPE = 'GLOBAL'</code> in <code>SomeLibrary.py</code>, see <a href="https://stackoverflow.com/questions/27637902/robot-framework-makes-two-instances-from-the-class-instead-of-one">Robot Framework makes two instances from the class instead of one</a> and the <a href="http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-library-scope" rel="nofollow noreferrer">Robot Framework User Guide</a></p>
  
  <h1>Other Proposals?</h1>
  
  <p>There are benefits and drawbacks to both proposals. Any recommendations? What structure would you propose?</p>