Running Jupyter notebook on external server and including local Python files
Answered
Hi all,
I'm running a Jupyter notebook from PyCharm connected to an external server. In addition to the code in the notebook, I would like to import another file foo.py from my local project into the notebook. However doing `import foo.py` does not work. What is the correct syntax to include a local file on the Jupyter notebook?
Please sign in to leave a comment.
Hi,
Could you please attach a screenshot that shows the problem?
Hi Anna,
the screenshot below shows my project with the notebook. I have the file poop.py which I'd like to import to the Jupyter notebook I'm running on the server, however just writing import poop.py throws an error, because the server can't find poop.py.
If PyCharm just replaced the import poop.py command with the text content of poop.py prior to sending it to the server, I think the issue would be solved. Is there a way to do that?
same problem here
solved :
notebook.ipynb
module:
__init__.py
my_file.py
inside notebook:
from module import my_file