Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

60 Days of Data Days! Live and on-demand sessions, challenges, study groups and more! And it's all FREE!. Join now. Learn more

Reply
Yazdan
Advocate II
Advocate II

Using Multiple %run Commands in Microsoft Fabric Notebooks

Tip: Using Multiple %run Commands in Microsoft Fabric Notebooks

 

I recently discovered something useful when working with multiple notebooks in Microsoft Fabric using the %run magic command.

 

When you try to load more than one notebook in the same cell like this:

 

%run NB_Slv_Logger
%run NB_Slv_Email_Configuration

 

You’ll get an error saying that no other code or commands can be combined with %run, and that no code can appear above or below the magic %run command in the same cell.

Even separating them with an empty line doesn’t work:

 

%run NB_Slv_Logger
 
%run NB_Slv_Email_Configuration

 

Result: Error – Fabric doesn’t allow multiple %run statements or any extra code in the same cell.

 

Solution:
Place each %run command in its own separate code cell.
Example:

 

# Cell 1
%run NB_Slv_Logger

 

 
# Cell 2
%run NB_Slv_Email_Configuration

 

After running both cells, you’ll have access to all functions, classes, and variables from both notebooks within your current notebook.


Key takeaway

Each %run must be executed independently in its own cell — no other code should exist above or below it. Once both are run, their code is fully imported and available.

 

Hope this helps anyone integrating multiple shared notebooks (e.g., for logging, configuration, or utilities) in Fabric!

7 REPLIES 7
v-saisrao-msft
Community Support
Community Support

HI @Yazdan,

Checking in to see if your issue has been resolved. let us know if you still need any assistance.

 

Thank you.

Hi,

As you can see in my post, this is not a problem or issue — I just shared my finding and solution for running multiple %run commands.

 

Thank you.

HI @Yazdan,

Thank you so much for sharing this, This kind of post is incredibly valuable to the community. Definitely consider turning this into a blog post so others can benefit from your experience more easily

Power BI Community Blog - Microsoft Fabric Community

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @Yazdan,

Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.

 

Thank you.

Hi,

As you can see in my post, this is not a problem or issue — I just shared my finding and solution for running multiple %run commands.

 

Thank you.

Hi @Yazdan,

Thank you for providing your insights. Kindly accept your response, as it will be beneficial to other community members.

 

Thank you.

BhaveshPatel
Super User
Super User

 Hi @Yazdan 

 

%run command is used for Global Parameters in Microsoft Fabric or Equivalent to Databricks Delta Lake.

 

BhaveshPatel_0-1760083738308.png

 

 

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

June Fabric Update Carousel

Fabric Monthly Update - June 2026

Check out the June 2026 Fabric update to learn about new features.