How can I import a Python class that is in two directories above and one below?
Question: How can I import a CustomerHelper class inside `customer_helper.py` from
`customer_helper_test.py`? It's possible? I used `from
..helpers..tests..app.helpers.customer_helper import CustomerHelper` but it's
invalid syntax.

Here is the folders organized:

    
    
    program/
        app/
            helpers/
                customer_helper.py
                __init__.py
        __init__.py
        tests/
            helpers/
                customer_helper_test.py
                __init__.py
            __init__.py
        __init__.py
    

Thanks in advance!


Answer: Always strive to use absolute imports.

    
    
    from program.app.helpers.customer_helper import CustomerHelper
    

If for some reason you absolutely can't, then

    
    
    from ...app.helpers.customer_helper import CustomerHelper
    

Note that `app` must be a package regardless.

