title: flask - nested resources
body: <p>I'm writing a restful server with flask in python and I'm looking for a way to create nested resources in separated files. For example, if I have resource named Foo and sub-resource named Bar, instead of writing something like this:</p>
  
  <p>demo_app.py:</p>
  
  <pre><code>from flask import Flask
  from flask_restplus import Api, Resource
  
  app = Flask(__name__)
  api = Api(app)
  name_space = api.namespace('foo')
  
  
  @name_space.route('/')
  class Foo(Resource):
      def get(self):
          return 'foo'
  
  
  @name_space.route('/bar')
  class Bar(Resource):
      def get(self):
          return 'bar'
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>I want to write Foo and Bar in different files:</p>
  
  <p>demo_app.py:</p>
  
  <pre><code>from flask import Flask
  from flask_restplus import Api, Resource
  
  app = Flask(__name__)
  api = Api(app)
  name_space = api.namespace('foo') 
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>foo.py:</p>
  
  <pre><code>from flask_restful import Resource
  from Receiver.demo_app import name_space
  @name_space.route('/')
  class Foo(Resource):
      def get(self):
          return 'foo'
  </code></pre>
  
  <p>bar.py:  </p>
  
  <pre><code>from flask_restful import Resource
  from Receiver.demo_app import name_space 
  @name_space.route('/bar')
  class Bar(Resource):
      def get(self):
          return 'bar'
  </code></pre>
  
  <p>But when I write it that way I get:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"&gt;
  &lt;title&gt;404 Not Found&lt;/title&gt;
  &lt;h1&gt;Not Found&lt;/h1&gt;
  &lt;p&gt;The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.&lt;/p&gt;
  </code></pre>
  
  <p>How can I connect between those classes? 
  Is there another way to write nested resources?</p>