Import Py File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 03:53 AM
How do i import a .py file in Databricks environment?
Any help will be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 04:48 AM
Hi @clentin , did you get an answer to this. Im looking for a similar thing. The api only imports .py as notebooks. I want them to be deployed as file type in workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2024 09:10 AM
Hi @clentin ,
The steps:
1. Create your .py to be imported as a file and not a notebook
2. In the notebook that uses your .py file append its path to sys.path
Check my answer to the similar question for more details:
https://community.databricks.com/t5/data-engineering/trying-to-use-python-source-file-as-module-in-d...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2025 02:58 AM - edited 01-30-2025 03:01 AM
Sorry to bring this up again, but I'm facing kind of similar problem.
We have Databricks Repos that is a copy of a GitHub repository. The GitHub contains only .py files, but when copied to Databricks, they all get converted to notebooks..Is there a way to choose which files to be and which to not be converted?
I'd like to develop modules in the same repo, but they won't work if they are copied as notebooks..

