-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python submodules cannot call each other using absolute imports #138
Comments
Qustion: why doesn't this cause an issue with the CI tests? |
Actually, option 2 editing |
Also - do we know why this was working for me, Tianyi and Ollie, but not @caiw? |
Yes, I'm curious about that — did you add something like |
This was actually a problem with my poetry environment! When correctly set up, poetry should install an editable copy of the package in the pythonpath. Then the importing all works fine. See also #72. |
When running the toolbox I'm encountering the following error:
It seems that the reason is that it looks like in Python you can't use absolute module importing from within a submodule. I.e., because
run_gridsearch.py
is insidekymata/
, it doesn't know whatkymata
is. When running in an IDE, this is solved automatically using option 2 below.The two solutions seem to be:
run_gridsearch.py
, instead of beginningfrom kymata.datasets.data_root import data_root_path
it would beginfrom .datasets.data_root import data_root_path
PYTHONPATH
variable.Which is best?
2 is much easier, but requires some documentation, and could cause subtle errors in case there are multiple copies of the toolbox around. It is also recommended against
1 is more "correct", and is probably what we should do at some point in preparation for #4.
The text was updated successfully, but these errors were encountered: