imports python3 in another folder
<p>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?</p>

<pre><code>âââ 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')
</code></pre>

<p>EDITED:</p>

<p><a href="http://i.stack.imgur.com/cgfvU.png" rel="nofollow">enter image description here</a></p>

<p>I believe I see the answer...
<br>
You have not defined main, perhaps try that. The reason why it works when called directly is because Python scripts are run in the order in which functions appear unless a specific function is called.</p>

<p>Try changing main.py to</p>

<pre><code>import bla
def mainfunction():
    bla.pront()
</code></pre>

<p>Then change launch.py to</p>

<pre><code>import main
main.mainfunction()
</code></pre>

<p>I hope this helps! :)</p>

python import module folder