Flask __init__.py import error
Question: I can not import functions from other files to `__init__.py` in a flask.
Importing something from a file gets an error 500.

**__init__.py**

    
    
    from flask import Flask
    from fel import fel
    
    app = Flask(__name__)
    
    @app.route("/")
    def hello():
        return "Hello World!"
    
    if __name__ == '__main__':
        app.run(debug=True)
    

**fel.py**

    
    
    def fel(a,b):
        c = a+b
        return (c)
    

If I delete the following line in the `__init__.py` file

    
    
    from fel import fel
    

Everything is OK.

`__init__.py` and `fel.py` are in the same directory

I am working in Python 3.4

Where is the mistake? edit: structures

    
    
    FlaskApp\
      __init__.py  
      fel.py
    


Answer: use relative import

    
    
    from .fel import fel
    
    fel(something)
    

Explanation:

> The problem of import fel is that you don't know whether its an absolute
> import or a relative import. fel could a module in python's path, or a
> package in the current module.

Source <http://programmers.stackexchange.com/questions/159503/whats-wrong-
with-relative-imports-in-python>

