title: AWS Chalice: Routes in multiple python files
body: <p>I'm starting AWS Lambda and I fell in love with Chalice. From what I understand it has the same idea of Flask, but using all requests "serverless". I would like to put together a complex structure, with several lambda script files. I find no such example.</p>
  
  <p><a href="https://aws.amazon.com/blogs/developer/chalice-0-4-0-5-deliver-local-testing-and-multifile-application-capabilities-for-python-serverless-application-development/" rel="nofollow noreferrer">In an update note here</a>, it says that from version 0.4 was added what seems to be exactly what I'm looking for. And in this example it shows just how to pull <a href="https://github.com/aws/chalice" rel="nofollow noreferrer">data from files inside</a> the "chalicelib" folder.</p>
  
  <p>Following this logic could create several folders within the "chalicelib", as if each folder represented a module of my application and within the folders each file would be a route with a stretch of source-code?</p>
  
  <hr>
  
  <p>I wonder if this is a viable solution:</p>
  
  <pre><code>app/
  ├── requirements.txt
  ├── app.py
  └── chalicelib
      ├── __init__.py
      ├── users
      │   ├── __init__.py
      │   ├── route.py
      │   └── controller.py
      └── teams
          ├── __init__.py
          ├── parameters.py
          └── controller.py
  </code></pre>
  
  <p><strong>app.py:</strong></p>
  
  <pre><code>import chalicelib
  </code></pre>
  
  <p><strong>chalicelib > __init__.py:</strong></p>
  
  <pre><code>from . import users, teams
  </code></pre>
  
  <p><strong>chalicelib > users > __init__.py:</strong></p>
  
  <pre><code>from . import route
  </code></pre>
  
  <p><strong>chalicelib > users > route.py:</strong></p>
  
  <pre><code>from app import app
  from . import controller
  
  @app.route("/users/test")
  def test():
      return controller.test()
  </code></pre>