imports python3 in another folder
Question: When I run launch.py it fails and when I run main.py directly it works.
launch.py just imports and runs main.py. Why?

    
    
    ├── dir
    │   ├── bla.py
    │   ├── __init__.py
    │   └── main.py
    ├── __init__.py
    └── launch.py
    
    launch.py
    ---------
        #!/usr/bin/env python
        # -*- coding: utf-8 -*-
    
        from dir import main
        main.main()
    
    main.py
    -------
    
        #!/usr/bin/env python
        # -*- coding: utf-8 -*-
        import bla
        bla.pront()
    
    
    bla.py
    ------
    
    def pront():
        print('pront')
    

EDITED:

[enter image description here](http://i.stack.imgur.com/cgfvU.png)


Answer: Using your layout and with the following files, we don't have problems.

### launch.py

    
    
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    from dir import main
    
    if __name__ == "__main__":
       main. main()
    

### main.py

    
    
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    try:
        from . import bla
    except:
        import bla
    
    def main():
        bla.pront()
    
    if __name__ == "__main__":
        main()
    

The `try ... except` structure is used in case the **_main.py_** was used
inside or outside the package.

Of course, there is a lot of info about it. You can start with
[this](http://stackoverflow.com/questions/16981921/relative-imports-in-
python-3).

