cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Import Py File

clentin
Contributor

How do i import a .py file in Databricks environment?

Any help will be appreciated.

 

clentin
6 REPLIES 6

tejaswi24
New Contributor III

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

filipniziol
Contributor III

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...

fifata
New Contributor II

@filipniziol @tejaswi24 

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..

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group