diff --git a/bokeh/util/compiler.py b/bokeh/util/compiler.py
index <HASH>..<HASH> 100644
--- a/bokeh/util/compiler.py
+++ b/bokeh/util/compiler.py
@@ -20,12 +20,20 @@ _plugin_prelude = \
 """
 (function outer(modules, cache, entry) {
   if (typeof Bokeh !== "undefined") {
+    var _ = Bokeh._;
+
     for (var name in modules) {
       Bokeh.require.modules[name] = modules[name];
     }
 
     for (var i = 0; i < entry.length; i++) {
-        Bokeh.Models.register_locations(Bokeh.require(entry[i]));
+        var exports = Bokeh.require(entry[i]);
+
+        if (_.isObject(exports.models)) {
+          Bokeh.Models.register_locations(exports.models);
+        }
+
+        _.extend(Bokeh, _.omit(exports, "models"));
     }
   } else {
     throw new Error("Cannot find Bokeh. You have to load it prior to loading plugins.");
Update plugins' prelude in bokeh.util.compiler