chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
809 stars 131 forks source link

How to Import modules from parent folder? #352

Closed objectc closed 4 years ago

objectc commented 4 years ago

If in the same level or subfolder, I can use import .module_path. How to do with the parent folder and why there is a . for the subfolder? Thanks.

mhsmith commented 4 years ago

To import from the parent package you use two dots, e.g. ..module_path. This can be extended to three or more dots for the grandparent package etc.

This issue tracker is only for Chaquopy issues; please don't ask general Python questions here.

mhsmith commented 4 years ago

Actually, import .module_path isn't valid Python syntax: it should be from . import module_path. Search for "python relative import" for more information.