My main nbdev directory contains two notebooks, class_dataset.ipynb and class_training.ipynb and I’ve successfully used the notebook2script() function to convert the notebooks into scripts inside a “scripts” directory. Inside of the class_training notebook I have “from scripts.class_dataset import *” and inside the corresponding script that is converted to “from .class_dataset import *” as one would expect. Also, within the class_training notebook I have a block that starts with if name == “main”: so that the module can be ran as a script. Everything works fine when I run the code from within the notebook, but when I do a “python class_training.py” from the command line I get the following:
File “scripts/class_training.py”, line 10, in
from .class_dataset import *
ImportError: attempted relative import with no known parent package
I’ve read what I think is the relevant nbdev documentation and the python documentation for modules and running modules as scripts. It seems like everything is set up correctly. What am I doing wrong?