title: GAE Webapp: the cost of importing a bunch of request handlers
body: <p>My python GAE app's central application file looks like this:</p>
  
  <pre><code>import webapp2
  import homepage
  import user_auth
  import user_confirm
  import admin_user
  import admin_config
  import config
  
  app = webapp2.WSGIApplication([
                                  (user_auth.get_login_url(), user_auth.LoginHandler),
                                  (user_auth.get_logout_url(), user_auth.LogoutHandler),
                                  ("/user/confirm", user_confirm.UserConfirmHandler),
                                  ("/admin/config", admin_config.AdminConfigHandler),
                                  ("/admin/user/add", admin_user.AdminAddUserHandler),
                                  ("/admin/user", admin_user.AdminUserHandler),
                                  ("/", homepage.HomepageHandler),
                              ], debug=True)
  </code></pre>
  
  <p>As you can see, I must import a bunch of request handlers, but for each request, only one of them is used, the other imports are just useless!<br>
  That's a big waste of memory and performance because those unnecessary imports also import other things on their own. Does Google App Engine have some "caching" mechanism or something that makes these unnecessary imports negligible? I think not.  </p>
  
  <p>How can I avoid them? I just haven't found out the way to import 1 Request Handler per request. If I put all the routing to app.yaml, that would work the way I want, but it makes things complex because I must write <code>app = webapp2.WSGIApplication(...</code> for every request handler file and repeat those boring urls twice (both in the python file and in app.yaml).</p>