Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import local module in jupyter notebook

A very basic questions on importing modules created locally.

I am unable to import a locally created module. The module exists in the current working directory

enter image description here

enter image description here

Am i missing something?

like image 286
Himanshu Avatar asked Sep 02 '25 13:09

Himanshu


1 Answers

I'm finding local library names must begin with a capital letter. If I keep all my local files in a folder called Code, I can import them; if it's called code, I cannot. (The names of subfolders and subfiles don't seem to suffer that restriction.)

This appears to be a Jupyter restriction, not a Python one -- from the command-line Python repl I can import whatever local .py file I want.

like image 89
Jeffrey Benjamin Brown Avatar answered Sep 05 '25 16:09

Jeffrey Benjamin Brown