0
votes

I have created an python_util.py in the same folder where I have my Jupyter Notebook. Now on Jupyter notebook I want to import that as a module.

from python_util import createLogging

createLogging is a function inside python_util.py

I get the following error -

No module named python_util Traceback (most recent call last): ImportError: No module named python_util

Can someone help me fix it ? Thanks.

1
Can you show us structure of your project files? - Tserenjamts
There is same problem with solution. This will help you to understand. visit reference: [stackoverflow.com/questions/17976158/… - Muhammad Usman Bashir

1 Answers

0
votes

You have added the local path to the path list.

import os
import sys
module_path = os.path.abspath(os.path.join('.'))
if module_path not in sys.path:
    sys.path.append(module_path)