(function(app) { var m = myapp.add_module(foo); m.actions = function() { } m.run(); })(myapp);