I’ve tried adding the following line to my handler script (main.py), but it doesn’t seem to work:
sys.path.append(‘subdir’)
subdir lives in the my root directory (i.e. the one containing app.yaml).
This doesn’t seem to work, because when I try to import modules that live in subdir, my app explodes.
1) Ensure you have a blank
__init__.pyfile insubdir.2) Use a full path; something like this:
Edit: providing more info to answer questions asked in a comment.
As Nick Johnson demonstrates you can place those three lines of code in a file called
fix_path.py. Then, in yourmain.pyfile, do thisimport fix_pathbefore all other imports. Link to a tested application using this technique.And, yes, the
__init__.pyfile is required; per the documentation: