title: Send Message between background.js and event.js
body: <p>I'm trying to have my <code>background.js</code> receive information from my <code>event.js</code> (they are both running as background scripts) or at least allow <code>background.js</code> to use a function from <code>event.js</code>.</p>
  
  <hr>
  
  <p>Why do I want to do this:</p>
  
  <p>I have set up my code so that <code>background.js</code> handles the main tasks.  </p>
  
  <p>My <code>content-scripts</code> need saved information now and then from <code>chrome.storage</code> so they need to send a message to a background page.  </p>
  
  <p>In order to keep the code organized, I create another background page called <code>event.js</code> with <code>chrome.runtime.onMessage</code> listener and all the functions for doing the requested tasks coming from the content scripts.</p>
  
  <p>Then I realize that <code>background.js</code> also needs to do some of those same functions, so in order to not duplicate the code, I have <code>background.js</code> use <code>chrome.runtime.sendMessage</code> to <code>event.js</code>.</p>
  
  <p>The expected result is that <code>event.js</code> communicates with <code>background.js</code> as successfully as the <code>content-scripts</code> do.</p>
  
  <p>The actual result is that the <code>event.js</code> never receives any messages from <code>background.js</code>. </p>
  
  <hr>
  
  <p>I've read the documentation on background pages and on message passing trying to find the answer or a hint. </p>
  
  <p><strong>Is there some reason these two pages cannot communicate through messagePassing?
  If so, how can I successfully pass information or functions between these two pages?</strong></p>