title: Python, how can I import modules that are in sub-directory?
body: <p>I am using Python and Flask to build a project.</p>
  
  <p>How can I import modules that are in sub-directory?</p>
  
  <p>here is the directory structure.</p>
  
  <pre><code>/application
    /apis
      settings.py
  index.py
  </code></pre>
  
  <p>and here is the index.py file.</p>
  
  <pre><code>from flask import Flask
  import os
  import sys
  import random
  from flask import render_template, request, jsonify, redirect, url_for, send_file, Response, make_response
  from werkzeug import secure_filename
  
  app = Flask(__name__)
  app.debug = True
  
  sys.path.append("apis")
  import settings
  </code></pre>
  
  <p>here is the settings.py file in apis folder.</p>
  
  <pre><code>from flask import Flask
  import pymongo
  import datetime
  import os
  import sys
  import random
  from flask import render_template, request, jsonify, redirect, url_for, send_file, Response, make_response
  from werkzeug import secure_filename
  
  app = Flask(__name__)
  app.debug = True
  
  ## About Us
  @app.route('/apis/settings/aboutus')
  def aboutus():
      return render_template('aboutus.html')
  </code></pre>
  
  <p>So, I tried to import settings module by using sys.path.append.</p>
  
  <p>When all codes was in index.py, it worked fine.</p>
  
  <p>If I hit this address <a href="http://domain.com:5000/apis/settings/aboutus" rel="nofollow">http://domain.com:5000/apis/settings/aboutus</a>, it supposed to show AboutUS page.</p>
  
  <p>However, it says "404 Not Found" after I split modules.</p>
  
  <p>Can you see the problem?</p>