# Python with Code Node

**URL:** <https://community.n8n.io/t/python-with-code-node/30252>\
**Category:** Questions\
**Tags:** code\
**Created:** [September 7, 2023, 6:29am UTC](https://community.n8n.io/t/python-with-code-node/30252 "2023-09-07T06:29:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Itay](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@Itay](https://community.n8n.io/u/Itay)\
**Post date:** [September 7, 2023, 6:29am UTC](https://community.n8n.io/t/python-with-code-node/30252/1 "2023-09-07T06:29:30Z")

</div>

I see that there’s now an option to run Python with the Code Node.  
Is it possible to pass the items object that is currently used when running JS code to the python and return it back to the rest of the JS nodes?  
I read in the docs that the packages are limited “This limits the available Python packages to the Packages included with Pyodide”. I’m not familiar with Pyodide, is there a way around this to add more packages?

Thank you.

---

<div class="post-metadata">

**Author:** ![EmeraldHerald](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emeraldherald/32/35355_2.png) [@EmeraldHerald](https://community.n8n.io/u/EmeraldHerald)\
**Post date:** [September 7, 2023, 1:42pm UTC](https://community.n8n.io/t/python-with-code-node/30252/3 "2023-09-07T13:42:29Z")

</div>

Hi @Itay 👋 Nice to see you again on the community forums!

You’d have to build this on your own in order to include any additional packages. Maybe our resident custom node builders @Jon or @marcus could help you out with this one? 🙏

---

<div class="post-metadata">

**Author:** ![Itay](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@Itay](https://community.n8n.io/u/Itay)\
**Post date:** [September 7, 2023, 3:02pm UTC](https://community.n8n.io/t/python-with-code-node/30252/4 "2023-09-07T15:02:34Z")

</div>

That’s unfortunate. My Plan B is to run process using JS and pass arguments to the python script that is saved as a file.  
Thank you for your answer @EmeraldHerald

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [September 7, 2023, 7:39pm UTC](https://community.n8n.io/t/python-with-code-node/30252/5 "2023-09-07T19:39:09Z")

</div>

Hey @Itay,

Can you share more on what you are actually trying to do?

---

<div class="post-metadata">

**Author:** ![Itay](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@Itay](https://community.n8n.io/u/Itay)\
**Post date:** [September 8, 2023, 11:25am UTC](https://community.n8n.io/t/python-with-code-node/30252/6 "2023-09-08T11:25:16Z")

</div>

Hey @Jon ,

I have this workflow with many Code Nodes. So far I’ve written every code node in JS while returning “items” object after every node. This way I pass items between all nodes. I would like some of the nodes to run python code. Read the same items dictionary and return it so that the rest of the nodes can use it.

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [September 8, 2023, 11:30am UTC](https://community.n8n.io/t/python-with-code-node/30252/7 "2023-09-08T11:30:30Z")

</div>

Hey @Itay,

It should be the same with the Python option, Can you share a small workflow example where it doesn’t work?

---

<div class="post-metadata">

**Author:** ![Itay](https://avatars.discourse-cdn.com/v4/letter/i/c5a1d2/32.png) [@Itay](https://community.n8n.io/u/Itay)\
**Post date:** [September 10, 2023, 8:35am UTC](https://community.n8n.io/t/python-with-code-node/30252/8 "2023-09-10T08:35:21Z")

</div>

I didn’t create any workflow using Python yet. I was wondering how it works before I invest time.  
My first concern was external packages, can I add pip packages that are not included with “Pyodide”?  
My second concern was managing the information between nodes. So far I always used the items object to pass information. If I understood correctly you said it’ll work the same way.  
Is there an example how to import the items object with Python code and return it?

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [September 11, 2023, 10:12am UTC](https://community.n8n.io/t/python-with-code-node/30252/9 "2023-09-11T10:12:56Z")

</div>

Hey @Itay,

For the data items it is mostly the same, When you add the code node to your workflow and select Python we show an example for how you can use things.

Officially we only support pacakges that are included with Pyodide which allows us to provide a secure sandbox for running the Python code in. If you were after using pip and more than what Pyodide offers you would need to create a custom image that includes python and use the exectute command node to run python scripts instead of using the code node.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [December 10, 2023, 10:13am UTC](https://community.n8n.io/t/python-with-code-node/30252/10 "2023-12-10T10:13:45Z")

</div>

Closed on December 10, 2023, 10:13am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
