folder_1 must be on the PYTHON_PATH, and must contain a file named
"__init__.py"
if you add a "__init__.py" to folder_2, then bar.py can be imported
from any other python script


in bar.py:
from folder_1 import foo
or
import folder_1.foo

in anyother.py:
from folder_1.folder_2 import bar


if you want to know the current PYTHON_PATH, you can run the python
script
"""
import sys
print sys.path
"""

with appengine apps, the root of your app is on the python path, so
just make sure every folder that contains a python file you want to
import has a "__init__.py" file in it, which can be an empty file.



On Jan 4, 3:52 am, dhruvg <[email protected]> wrote:
> i have a folder structure like the following:
>
> ./folder_1
>   ./foo.py
>   ./folder_2
>     ./bar.py
>
> in bar.py:
> i want to import the foo module.
>
> what's the best way to do this?
>
> thanks in advance.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to