Robin
Robin

Reputation: 71

How to import a folder in jupyternotebook

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import os
import sys
import utils
%matplotlib inline

Hi! I am new at this and am facing the following error:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-9-93962065badc> in <module>
      5 import sys
      6 #sys.path.insert(1,'C:\Users\Robin\Downloads\project\Project')
----> 7 import utils
      8 get_ipython().run_line_magic('matplotlib', 'inline')
      9 

utils is a folder that contains several files. I am facing a hard time finding how to import the folders into jupyternotebook. Any help will be appreciated. Thanks

Upvotes: 1

Views: 5732

Answers (1)

Juan C. Vecino
Juan C. Vecino

Reputation: 58

You can add the directory containing the file you wish to import to your path and then import the file as shown below.

import sys  
sys.path.insert(0, '/path/to/application/app/folder')
import file

Upvotes: 2

Related Questions