There is no simple way to import python files in another directory. This is unrelated to the jupyter notebook
Here are 3 solutions to your problem
- You can add the directory containing the file you want to import to your path and then import the file like this:
import sys sys.path.insert(0, '/path/to/application/app/folder') import file
- You can create a local module by having an empty
__init__.py
file in the folder you want to import. There are some weird rules regarding the folder hierarchy that you have to take into consideration. - You can create a module for the file you wish to import and install it globally.
Related Posts:
- No module named pandas_datareader
- Relative imports – ModuleNotFoundError: No module named x
- Python: ‘ModuleNotFoundError’ when trying to import module from imported package
- Relative imports – ModuleNotFoundError: No module named x
- Relative imports in Python 3
- Relative imports in Python 3
- Relative imports in Python 3
- I get a syntax error and an error saying illegal target for variable annotation. How do I fix it?
- ‘dict’ object has no attribute ‘has_key’
- Series Summation using for loop in python
- Python 3: UnboundLocalError: local variable referenced before assignment
- Why Am I Getting ELIF Invalid Syntax Error?
- Alternative to scipy.misc.imresize()
- Get degree of each nodes in a graph by Networkx in python
- Dlib installation error?
- Virtualenv – workon command not found
- How do I create a popup window in tkinter?
- ‘python3’ is not recognized as an internal or external command, operable program or batch file
- How do I remove/delete a virtualenv?
- ImportError: No module named ‘cv2’ Python3
- pandas equivalent of R’s cbind (concatenate/stack vectors vertically)
- Why would cv2.COLOR_RGB2GRAY and cv2.COLOR_BGR2GRAY give different results?
- Pip install on Mac OS gets error: command ‘/usr/bin/clang’ failed with exit code 1
- unsupported format string passed to numpy.ndarray
- How to use filter, map, and reduce in Python 3
- converting time from UTC to CST
- How to uninstall a package installed with pip install –user
- not all arguments converted during string formatting.. NO % variables
- working of \n in python [duplicate]
- How is Anaconda related to Python?
- PermissionError: [Errno 13] in Python
- FileNotFoundError: [WinError 2] The system cannot find the file specified:
- Python error “ImportError: No module named”
- How to correct TypeError: Unicode-objects must be encoded before hashing?
- How to install python3 version of package via pip on Ubuntu?
- TypeError: ‘float’ object not iterable
- Importing class from another file [duplicate]
- Dice rolling simulator in Python
- ImportError: libcublas.so.9.0: cannot open shared object file
- csv.Error: iterator should return strings, not bytes
- NameError: global name ‘xrange’ is not defined in Python 3
- What does “SyntaxError: Missing parentheses in call to ‘print'” mean in Python?
- How to import cv2 in python3?
- Python 3.2 Unable to import urllib2 (ImportError: No module named urllib2)
- Error when executing `jupyter notebook` (No such file or directory)
- How do I unload (reload) a Python module?
- How to resolve TypeError: ‘No Numeric Data to Plot’, when numeric data exists in Python
- How can I solve ” module ‘pandas’ has no attribute ‘scatter_matrix’ ” error?
- How to import cv2 in python3?
- TypeError: method() takes 1 positional argument but 2 were given
- How can I get a list shape without using numpy?
- How can I flush the output of the print function?
- What is the purpose of “pip install –user …”?
- Infinite integer in Python
- ‘pip3’ is not recognized as an internal or external command, operable program or batch file
- Generate random sentences in python
- django import error – No module named core.management
- How do you use subprocess.check_output() in Python?
- Dice rolling simulator in Python
- List attributes of an object [duplicate]
- “The path python3 (from –python=python3) does not exist” error
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- Convert bytes to int?
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- Python: can’t assign to literal
- “Initializing” variables in python?
- Why does using from __future__ import print_function breaks Python2-style print?
- TypeError; Must use key word argument or key function in python 3.x
- Python FileNotFound
- Type error Unhashable type:set
- AttributeError: ‘module’ object has no attribute ‘urlretrieve’
- Replacing a character from a certain index
- ImportError: No module named ‘google’
- Ruby equivalent for Python’s “try”?
- Django Rest Framework — no module named rest_framework
- Unsupported operation :not writeable python
- NameError: global name ‘unicode’ is not defined – in Python 3
- TypeError: int() argument must be a string, a bytes-like object or a number, not ‘list’
- Object of type ‘map’ has no len() in Python 3
- Python TypeError: non-empty format string passed to object.__format__
- AttributeError: ‘Series’ object has no attribute ‘reshape’
- how to exit a python script in an if statement
- How to do a Sigma in python 3
- Not able to pip install pickle in python 3.6
- Decode Hex String in Python 3
- built-in range or numpy.arange: which is more efficient?
- Printing subscript in python
- How to clear Tkinter Canvas?
- TypeError: ‘range’ object does not support item assignment
- How to install pip for Python 3 on Mac OS X?
- Meaning of list[-1] in Python
- Tkinter error: Couldn’t recognize data in image file
- How to install Openpyxl with pip
- Python cant convert ‘list’ object to str error [closed]
- Generate a random letter in Python
- What’s the correct way to convert bytes to a hex string in Python 3?
- During handling of the above exception, another exception occurred
- ‘module’ has no attribute ‘urlencode’
- How to install PyQt4 on Windows using pip?
- How to install PyQt4 on Windows using pip?