- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2025 06:52 AM
Hi JooseSauli,
How are you doing today?, As per my understanding, Hey JS, totally get where you're coming from—it's super common to want to keep shared helper code clean and reusable without making every notebook author mess with sys.path. The smoothest way to do this in Databricks is to package your helper code as a Python wheel (.whl) and install it as a custom library on the cluster, either through the UI or using a Databricks Asset Bundle if you're deploying. This way, the module is available across all notebooks, regardless of folder structure, and users can simply import foo without worrying about paths or %run. It may feel like extra setup at first, but once it’s packaged, updating and maintaining it becomes super easy. If you’re not ready for packaging yet, another option is to store the .py files in DBFS (like /dbfs/python_libs/foo.py) and just set the path once in a cluster init script, which adds it to sys.path globally on startup. This avoids manual changes in every notebook. Let me know if you want a quick guide for either setup—happy to help make it easy for your team!
Regards,
Brahma