title: Node event emitter in other modules
body: <p>I have 3 different javascript files, the smallest one is emitting an event, meanwhile the second (bigger one) file picks up the event and sends it further to the main file.
   This is what I have tried so far:</p>
  
  <pre><code>//mini.js
  var EventEmitter = require('events').EventEmitter;
  var ee = new EventEmitter;
  
  console.log("Emitting event");
  var message = "Hello world";
  ee.emit('testing',message);
  
  
  //second.js
  var mini = require('./mini.js');
  var EventEmitter = require('events').EventEmitter;
  var ee = new EventEmitter;
  
  mini.on('testing',function(message){
      console.log("Second file received a message:",message);
  
      console.log("Passing further");
      ee.emit('testing',message);
  });
  
  //main.js
  var sec = require('./second.js');
  
  sec.on('testing',function(message){
      console.log("Main file received the message",message);
  });
  </code></pre>
  
  <p>However, I get </p>
  
  <pre><code>mini.on('testing',function(message){
          ^
  TypeError: undefined is not a function
  </code></pre>
  
  <p>error when executing the file with node.</p>
  
  <p>What am I doing wrong here?
  Thanks</p>