- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 12:33 AM
We are able to run a notebook that references Python code using import statements from a Databricks repo
with the source code checked out. However, we encounter a ModuleNotFoundError when executing the same code from a folder.
Error: ModuleNotFoundError: No module named ...
Is there a future roadmap to enable code execution from Databricks folder and subfolders?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 12:56 AM
Hi Kartik,
Can you elaborate further on your query? I may not able to understand you properly but if your source code is checked out to databricks repos and you want to execute your code for testing purposes , had you try setting up your repo dir into sys paths?
this can go into the top cell of your execution notebook before you're doing your imports.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 12:56 AM
Hi Kartik,
Can you elaborate further on your query? I may not able to understand you properly but if your source code is checked out to databricks repos and you want to execute your code for testing purposes , had you try setting up your repo dir into sys paths?
this can go into the top cell of your execution notebook before you're doing your imports.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 03:20 AM
Hi @Kartikb ,
This feature is already available.
As @saurabh18cs mentioned, you probably have not added the location of your python code to sys.path.
Also, it is important to note, that your python code must be a file, and not a notebook. You can recognize by checking the object icon or object type:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 04:42 AM
@Kartikb Best approach is by creating a package and Install Code as a Module or Wheel. This ensures your code is accessible across notebooks and distributed jobs without manual path adjustments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 05:21 AM

