'databricks doesn't see submodule

I have a problem with databricks. I have a structure:

root:
file1.py
--------
    -subdirectory:
    module1.py
    module2.py
    .........

in the file file1.py I use modules from subdirectory:

import subdirectory.module1

But databricks doen't see this module and I get an error that this module doesn't exist.

Thanks!



Solution 1:[1]

Try to do a %run command, which will import all the functions there.

%run subdirectory/module1.py

Vasyl

Solution 2:[2]

you can create your functions in .whl(wheel) files, then you install in the cluster and in the notebook use the lib import, instantiate the class and use

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vasiliy Nadolskiy
Solution 2 Romerito Morais