I'm trying to create a project with the following structure:
my_file.ipynb
my_package_directory > __init__.py test.py
Within test.py lets say I have a very simple class:
class Test:
def __init__(self, name):
self.name = name
from with in a code cell I try to insatiate the class and print out the defined variable:
from my_package_directory.test import Test
test = Test('bob')
print(test.name)
If I try to run the cell I get an error:
ImportError: cannot import name 'Test' from 'my_package_directory.test'
Is there a certain way to do this in a Jupyter notebook?
Thank you.
import my_package_directory.test as t; print(dir(t))?['Test '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'const', 'os']constandosin that output list since those aren't imported or defined in thattest.py...