There is a module in a folder one level up
- root
- mylibs
- mylib.py
- pipelines
- mypipeline.py
- mylibs
mypipeline defines a delta live table. How can I import the mylib module?
The problem is that I cannot get the directory of mypipeline.py since all commands are returning the current working directory.
There is a difference when the code is running from a Repo vs. code is running from a notebook in a workspace:
sys.pathis automatically populated with two entries: current directory and root of the Reposys.pathSo in you case you will need to have some code in your DLT notebook to add a directory with your package into the
sys.path. There are two approaches to that:mylibs. Something like this:mylibsvia DLT settings and just do: