-
Notifications
You must be signed in to change notification settings - Fork 382
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
Using jupytext in a nested project can result in re-import of the current module #1208
Comments
I created a repo demonstrating this issue. To repro the problem, clone the repo, then run
from the repo root. In the Jupyter UI that appears, open |
Thank you @kerrickstaley for reporting this. I am not sure how I can help with this. Would you get the same issue if you were to run |
I'm using Jupytext on a project with a nested structure, something like
I run
to launch Jupyter so that e.g.
works inside
foo/__init__.py
.The problem I'm seeing is that if I put the line
inside
foo/__init__.py
, then when I runfoo/__init__.py
in Jupyter, the module is imported twice, once assys.modules['__main__']
and once assys.modules['foo']
. This is confusing and can lead to weird issues when you haven't saved your notebook, so the.py
file on disk differs from the file you have loaded in Jupyter.Is there a good way to deal with this problem? In this example, what we want is for
foo/__init__.py
to "know" that it isfoo
and not__main__
when we load it in Jupyter.The text was updated successfully, but these errors were encountered: