About relative path in Google Mobile Endpoint (Python)

35 views
Skip to first unread message

Dechen Jigme

unread,
Mar 30, 2015, 12:03:02 AM3/30/15
to google-a...@googlegroups.com
Hi all,

Currently I got stuck in importing a module in parent folder from Endpoint API subfolder as following: 
App
      Module_A.py
      EndpointB
             b_api.py
  So in b_api.py, I am trying to import classA in Module_A.py.

I have been trying to work around as recommended in stackoverflow for "importing a module in parent folder with Python" but none works.
Would you help me to figure out and work around for this case? 
Thank you very much, 
Best,
Dechen Jigme

Alex Martelli

unread,
Mar 30, 2015, 8:56:34 PM3/30/15
to google-a...@googlegroups.com
If you add empty __init__.py files to each directory (to turn them into packages),

    from ..Module_A import classA

should work.

Alex

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/547b40c8-21b5-49ed-98ec-873b8ddc5464%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages