title: Robot Framework: Do something after the execution ends using a library as a listener
body: <p>I am trying to gather the files: <strong>output.xml, report.html and log.html</strong> when the whole execution ends.</p>
  
  <p>I can use a listener for this purpose but I want to avoid write a line like:</p>
  
  <p><strong>robot --listener "SomeListener.py" YourTestSuite.robot</strong></p>
  
  <p>Then, I looked at the documentation and I found that I can use a Test Library as a Listener and import it in my Test Suite, for example:</p>
  
  <pre><code>class SomeLibrary(object):
      ROBOT_LISTENER_API_VERSION = 2 # or 3
      ROBOT_LIBRARY_SCOPE = "GLOBAL" # or TEST SUITE
  
      def __init__(self):
          self.ROBOT_LIBRARY_LISTENER = self
  
      def start_suite(self, data, result):
          pass
  
      def close(self):
          pass
  </code></pre>
  
  <p>My problem is that the <strong>close</strong> method is called when the library goes out of the scope. So, I cannot gather the report files because they don't exist in that moment and I receive an Error. I also tried with the method:</p>
  
  <pre><code>def report_file(self, path):
      pass
  </code></pre>
  
  <p>But, nothing happens, I guess that it could be because a Library as a Listener cannot use this methods from the <strong>Listener API</strong> or because the file is still not created.</p>
  
  <p>Any idea about How can I gather those files using a library as a Listener?
  I am open to ideas or suggestions.</p>
  
  <p>Thanks.</p>