<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Find root path to Repo for .py file import in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/find-root-path-to-repo-for-py-file-import/m-p/7000#M2995</link>
    <description>&lt;P&gt;Ok, I figured it out. If you just make it a Python module by adding an empty&amp;nbsp;&lt;/P&gt;&lt;P&gt;`__init__.py`, Databricks will load it on start. Then, you can just import it. &lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 22:14:44 GMT</pubDate>
    <dc:creator>MetaRossiVinli</dc:creator>
    <dc:date>2023-03-27T22:14:44Z</dc:date>
    <item>
      <title>Find root path to Repo for .py file import</title>
      <link>https://community.databricks.com/t5/data-engineering/find-root-path-to-repo-for-py-file-import/m-p/6999#M2994</link>
      <description>&lt;P&gt;I want to import a Python function stored in the following file path:&lt;/P&gt;&lt;P&gt;`&amp;lt;repo&amp;gt;/lib/lib_helpers.py`&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to import the function from any file in my repo. For instance from these:&lt;/P&gt;&lt;P&gt;`&amp;lt;repo&amp;gt;/notebooks/etl/bronze/dlt_bronze_elt`&lt;/P&gt;&lt;P&gt;`&amp;lt;repo&amp;gt;/workers/job_worker`&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is possible to get the root path of the repo? This way people on my team can clone the repo but the paths will still work. I think I want the import code to look something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;repo_root = &amp;lt;&amp;lt;call to get the root of the Databricks Repo&amp;gt;&amp;gt;
sys.path.append(os.path.abspath(f'{repo_root}/lib/'))
from lib_helpers import helper_func&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am still new to Databricks. Does dbutils or another util help with this?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 20:05:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/find-root-path-to-repo-for-py-file-import/m-p/6999#M2994</guid>
      <dc:creator>MetaRossiVinli</dc:creator>
      <dc:date>2023-03-27T20:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find root path to Repo for .py file import</title>
      <link>https://community.databricks.com/t5/data-engineering/find-root-path-to-repo-for-py-file-import/m-p/7000#M2995</link>
      <description>&lt;P&gt;Ok, I figured it out. If you just make it a Python module by adding an empty&amp;nbsp;&lt;/P&gt;&lt;P&gt;`__init__.py`, Databricks will load it on start. Then, you can just import it. &lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 22:14:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/find-root-path-to-repo-for-py-file-import/m-p/7000#M2995</guid>
      <dc:creator>MetaRossiVinli</dc:creator>
      <dc:date>2023-03-27T22:14:44Z</dc:date>
    </item>
  </channel>
</rss>

