<?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: Import notebook from .py file in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4398625#M7016</link>
    <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for your response! You’re right when exporting a Fabric notebook as a .py file and re-importing it, Fabric does not automatically split it into multiple cells. Currently, Fabric only maintains cell structure when working with .ipynb files.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If you need to frequently transfer notebooks, I recommend working with .ipynb instead of .py for seamless import/export.&lt;/P&gt;
&lt;P&gt;I agree that Fabric should ideally recognize its own .py format properly. If this is an important workflow for you, I encourage you to share your feedback and vote for this idea on the Power BI Ideas Forum:&lt;span class="lia-unicode-emoji" title=":link:"&gt;🔗&lt;/span&gt; &lt;A href="https://ideas.fabric.microsoft.com/" target="_blank"&gt;Home&lt;/A&gt;, This helps the Microsoft team prioritize feature enhancements based on user demand.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If this helps, then please &lt;STRONG&gt;Accept it as a solution&lt;/STRONG&gt; and dropping a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" so other members can find it more easily.&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2025 17:16:00 GMT</pubDate>
    <dc:creator>v-ssriganesh</dc:creator>
    <dc:date>2025-02-06T17:16:00Z</dc:date>
    <item>
      <title>Import notebook from .py file</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4396753#M6963</link>
      <description>&lt;P&gt;I have notebook code that has been exported as .py file and is formatted like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Fabric notebook source

# METADATA ********************

# META {
# META   "kernel_info": {
# META     "name": "synapse_pyspark"
# META   },
# META   "dependencies": {
# META     "lakehouse": {
# META       "default_lakehouse": "&amp;lt;Lakehouse ID&amp;gt;",
# META       "default_lakehouse_name": "Metadata",
# META       "default_lakehouse_workspace_id": "&amp;lt;Workspace ID&amp;gt;"
# META     }
# META   }
# META }

# MARKDOWN ********************

# # Import Core Code

# CELL ********************

%run "./00 - Connections"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I import this, it just puts all this code into a single cell in a new notebook (which is obviously not what I want). Am I doing something wrong? It would be an enormous waste of my time to reformat all of this manually. Any help is much appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2025 16:14:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4396753#M6963</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-05T16:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Import notebook from .py file</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4397503#M6982</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to the Microsoft Fabric Community.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I understand that you are facing an issue were importing a&amp;nbsp;.py&amp;nbsp;file into a notebook results in all the code being placed into a single cell.&lt;/P&gt;
&lt;P class="lia-align-left"&gt;You can modify the&amp;nbsp;.py&amp;nbsp;script to include markers or comments that can be recognized by the notebook environment to split the code into different cells automatically.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(OR)&lt;/P&gt;
&lt;P&gt;Another approach is to import the&amp;nbsp;.py&amp;nbsp;file as a module in the notebook. This allows you to call functions and classes defined in the&amp;nbsp;.py&amp;nbsp;file without having to reformat the entire script. Here are the steps:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a Python file containing the code you want to import.&lt;/LI&gt;
&lt;LI&gt;Save the Python file with a&amp;nbsp;.py&amp;nbsp;extension.&lt;/LI&gt;
&lt;LI&gt;Move the Python file to the same directory as your Jupyter notebook.&lt;/LI&gt;
&lt;LI&gt;Import the Python file as a module in your Jupyter notebook using the&amp;nbsp;import&amp;nbsp;statement.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I hope these suggestions assist you in resolving the issue. If they do, please accept it as a solution and give a "Kudos" to help other members find it more easily.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 05:05:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4397503#M6982</guid>
      <dc:creator>v-ssriganesh</dc:creator>
      <dc:date>2025-02-06T05:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Import notebook from .py file</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4398046#M6999</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't want the code as module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know I can modify the code to be recognized correctly as several notebook cells, but that's exactly what I hoped to avoid. Also, as far as I can tell, if I download a notebook as .py, and upload the result, it also gets put into a single cell. So Fabric doesn't even recognize its own formatting and only the .ipynb-format is correctly recognized upon import. Or am I missing something?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 11:17:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4398046#M6999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-06T11:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Import notebook from .py file</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4398625#M7016</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for your response! You’re right when exporting a Fabric notebook as a .py file and re-importing it, Fabric does not automatically split it into multiple cells. Currently, Fabric only maintains cell structure when working with .ipynb files.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If you need to frequently transfer notebooks, I recommend working with .ipynb instead of .py for seamless import/export.&lt;/P&gt;
&lt;P&gt;I agree that Fabric should ideally recognize its own .py format properly. If this is an important workflow for you, I encourage you to share your feedback and vote for this idea on the Power BI Ideas Forum:&lt;span class="lia-unicode-emoji" title=":link:"&gt;🔗&lt;/span&gt; &lt;A href="https://ideas.fabric.microsoft.com/" target="_blank"&gt;Home&lt;/A&gt;, This helps the Microsoft team prioritize feature enhancements based on user demand.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If this helps, then please &lt;STRONG&gt;Accept it as a solution&lt;/STRONG&gt; and dropping a "&lt;STRONG&gt;Kudos&lt;/STRONG&gt;" so other members can find it more easily.&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 17:16:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Import-notebook-from-py-file/m-p/4398625#M7016</guid>
      <dc:creator>v-ssriganesh</dc:creator>
      <dc:date>2025-02-06T17:16:00Z</dc:date>
    </item>
  </channel>
</rss>

