Assuming that welcome is in easygui.py, you want:
def main():
externals.easygui.welcome()
As these things can get tedious to type, it's often customary to import subpackages under an abbreviated name:
import externals.easygui as eg
def main():
eg.welcome()
Alternatively, if you can make the whole thing a package by adding __init__.py, and then you can control the namespace which gets imported from there ...
As far as sideways imports go, here's a test directory structure I set up:
steffen
|- __init__.py
|- main.py
|- easygui
|- __init__.py
|- gui.py
|- external
|- __init__.py
|- welcome.py
Now, (for simplicity) each __init__.py simply imports the files/modules contained in that directory. So, in steffen:
#steffen.__init__.py
import main
import easygui
import external
and in external
#steffen/external/__init__.py
import welcome
and so forth.
for the actual code:
main.py:
import easygui
def main():
easygui.gui.welcome()
easygui/gui.py:
import steffen.external as se
def welcome():
se.welcome.hello()
external/welcome.py
def hello():
print "Hello"
Now I can use all of this. In the parent directory of steffen (just to make sure the package steffen is on PYTHONPATH), I can:
import steffen
steffen.main.main()
Phew! Now, it's a little silly to have steffen.main.main(). If you want to refer to the function as just steffen.main(), you can set that up in steffen.__init__.py. Just change it to:
#steffen.__init__.py
from main import main
import easygui
import external
So, if you would call a function by foo.func() in __init__.py, you'll call it as steffen.foo.func() in a script that imports steffen. Likewise, if you would call the function as foo() in __init__.py, you'll call it as steffen.foo() in a script that imports steffen. Hopefully that makes sense. There's a lot to digest in this simplest working example I could come up with. The upside, if you can work through all of this and understand it, then you know almost everything there is to know about writing python packages (we haven't talked about relative imports which could be used here too, or about writing a setup.py to actually install your package, but those are fairly easy to understand once you understand this stuff).