<?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: How to create classes that can be instantiated from other notebooks? in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128020#M10512</link>
    <description>&lt;P&gt;OK, makes sense to me, thanks!&lt;BR /&gt;Perfect!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Aug 2025 09:49:37 GMT</pubDate>
    <dc:creator>Alex79</dc:creator>
    <dc:date>2025-08-11T09:49:37Z</dc:date>
    <item>
      <title>How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128003#M10510</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am familiar with object oriented programming and cannot really get my head around the philosophy of coding in Databricks. My approach that naturally consists in creating classes and instantiating objects does not seem to be the right one.&lt;/P&gt;&lt;P&gt;Can someone explain to me how Databricks is expected to be used, and if this is possible to do so, then how to create a simple 'foo' class that I can instantiate outside of its notebook definition?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks -&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 09:09:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128003#M10510</guid>
      <dc:creator>Alex79</dc:creator>
      <dc:date>2025-08-11T09:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128017#M10511</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/125712"&gt;@Alex79&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Typically you define all the logic in plain old python modules, where you can have classes and functions. So for example, you can define following python module (in this case I'm defining simple function, but it could be class - it doesn't matter for the sake of example).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="szymon_dybczak_0-1754904584166.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/18922iCDC2AD67E22D9D8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="szymon_dybczak_0-1754904584166.png" alt="szymon_dybczak_0-1754904584166.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And now my notebook could be the client of that module and import it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="szymon_dybczak_1-1754904714304.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/18923i853544D9244018AC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="szymon_dybczak_1-1754904714304.png" alt="szymon_dybczak_1-1754904714304.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would say that is the most common approach. So you have all the logic defined in python module that you can reuse and then those libraries are imported in notebooks (so notebooks act like orchestrator of the code).&lt;BR /&gt;But you can also use python wheel files if you want or stick only to py files and orchestrate those. You don't have use notebooks at all.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 09:35:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128017#M10511</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-11T09:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128020#M10512</link>
      <description>&lt;P&gt;OK, makes sense to me, thanks!&lt;BR /&gt;Perfect!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 09:49:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128020#M10512</guid>
      <dc:creator>Alex79</dc:creator>
      <dc:date>2025-08-11T09:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128021#M10513</link>
      <description>&lt;P&gt;No problem&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/125712"&gt;@Alex79&lt;/a&gt;&amp;nbsp;. If the answer was helpful to you, please consider marking it as accepted soution.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 09:54:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128021#M10513</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-11T09:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128023#M10514</link>
      <description>&lt;P&gt;Cool&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for this. Will we have to define absolute/relative parts in the "from __ import ___" statement if the module doesn't live in the same directory as the notebook? What's the normal practice for this in production? For instance, if you want to share this module (which will likely be updated) with your colleagues, I need to look into what Python Wheel Files offer.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;BS&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 10:02:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128023#M10514</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-08-11T10:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128025#M10515</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/146924"&gt;@BS_THE_ANALYST&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;If modules don't live in the same directory you need to add directory that contains your module to sys.path. &lt;SPAN&gt;&amp;nbsp;You can specify directories using a relative path, as in the following example:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import sys
import os
sys.path.append(os.path.abspath('..'))&lt;/LI-CODE&gt;&lt;P&gt;Here's a documentation entry where all of this is well described:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://docs.databricks.com/aws/en/files/workspace-modules" target="_blank"&gt;Work with Python and R modules | Databricks Documentation&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If there is a need to share module with colleagues than I guess wheel file is a perfect fit for that purpose &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 10:14:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128025#M10515</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-11T10:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128027#M10516</link>
      <description>&lt;P&gt;Legendary,&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CatGIF.gif" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/18925iA6721FBCCB9322B6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CatGIF.gif" alt="CatGIF.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;All the best,&lt;BR /&gt;BS&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 10:17:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128027#M10516</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-08-11T10:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create classes that can be instantiated from other notebooks?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128032#M10517</link>
      <description>&lt;P&gt;No problem, happy that I could clarify some things for you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Aug 2025 10:24:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/how-to-create-classes-that-can-be-instantiated-from-other/m-p/128032#M10517</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-11T10:24:49Z</dc:date>
    </item>
  </channel>
</rss>

