# Import python script

**URL:** <https://forum.dynamobim.com/t/import-python-script/24808>\
**Category:** Developers\
**Created:** [August 14, 2018, 11:50am UTC](https://forum.dynamobim.com/t/import-python-script/24808 "2018-08-14T11:50:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hcmutkhanghaxuan](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@hcmutkhanghaxuan](https://forum.dynamobim.com/u/hcmutkhanghaxuan)\
**Post date:** [August 14, 2018, 11:50am UTC](https://forum.dynamobim.com/t/import-python-script/24808/1 "2018-08-14T11:50:09Z")

</div>

I’ve used python script in dynamo to write some code but I really that I need to import some py script from python34. I copied and pasted a py file from Python34 into IronPython2.7 but when I import that py file, it doesn’t work. So could you guys help me with this.

---

<div class="post-metadata">

**Author:** ![mellouze](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mellouze](https://forum.dynamobim.com/u/mellouze)\
**Post date:** [August 14, 2018, 11:53am UTC](https://forum.dynamobim.com/t/import-python-script/24808/2 "2018-08-14T11:53:45Z")

</div>

Hi,

We wannot help you if you do not provide at least a screenshot of your code with the error you get. So many errors can happen…

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [August 14, 2018, 11:55am UTC](https://forum.dynamobim.com/t/import-python-script/24808/3 "2018-08-14T11:55:10Z")

</div>

One ‘‘error’’ is that the syntax is not the same in python 2.7 and 3.x…

---

<div class="post-metadata">

**Author:** ![hcmutkhanghaxuan](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@hcmutkhanghaxuan](https://forum.dynamobim.com/u/hcmutkhanghaxuan)\
**Post date:** [August 14, 2018, 12:26pm UTC](https://forum.dynamobim.com/t/import-python-script/24808/4 "2018-08-14T12:26:14Z")

</div>

Guys, I know that ironpython and python have its own Lib but there are some modules that they overlapped each other so I’ve come up with a crazy idea that I copy and paste all Python34\Lib into Ironpython2.7\Lib. With that idea I can import in ironpython like in python34. Is that a good idea, guys? I’m afraid of losing some import data in some module which can ruin ironpython2.7\Lib.

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [August 14, 2018, 1:27pm UTC](https://forum.dynamobim.com/t/import-python-script/24808/5 "2018-08-14T13:27:42Z")

</div>

I am afraid this doesn’t work like that. Bad idea.

---

<div class="post-metadata">

**Author:** ![hcmutkhanghaxuan](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@hcmutkhanghaxuan](https://forum.dynamobim.com/u/hcmutkhanghaxuan)\
**Post date:** [August 14, 2018, 2:31pm UTC](https://forum.dynamobim.com/t/import-python-script/24808/6 "2018-08-14T14:31:12Z")

</div>

I figure out that when i use :  
import sys  
sys.path.append(’…’)  
import …

I could import anything from ironpython2.7/Lib  
and have you ever tried my idea before?

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [August 14, 2018, 7:43pm UTC](https://forum.dynamobim.com/t/import-python-script/24808/7 "2018-08-14T19:43:48Z")

</div>

I am saying its a bad idea to copy/paste a library folder from Python 3.4 into library folder for IronPython 2.7. These two have a bit of overlap in functionality, and some libraries will work, but for the most part, they will not. I would be more selective when doing that. If I needed the threading library I would copy that and see if it works. I would probably actually go online and download the appropriate version of that library. IronPython is built on top of Python 2.7 so get that installed first. Newer libraries will be a hit and miss exercises and for the most part a bit of a wasted time.

Yes, I believe I tried that before and it was a bad idea. It screwed up my install of IronPython and I had to wipe it clean.

You can always ask others around. @Gui_Talarico is a great Python resource.

---

<div class="post-metadata">

**Author:** ![hcmutkhanghaxuan](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@hcmutkhanghaxuan](https://forum.dynamobim.com/u/hcmutkhanghaxuan)\
**Post date:** [August 15, 2018, 12:44am UTC](https://forum.dynamobim.com/t/import-python-script/24808/9 "2018-08-15T00:44:18Z")

</div>

Thanks guys, I really appreciate what you guys shared, so what if I wanna import a py script from python34 and of course, in that py script it also import many py script that didn’t exist in ironpython2.7,then I have to import that things so there are lots of things to import. So guys, could you guys show me the way to import a python file from python34 into ironpython2.7 in dynamo?

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [August 15, 2018, 1:27pm UTC](https://forum.dynamobim.com/t/import-python-script/24808/11 "2018-08-15T13:27:34Z")

</div>

I give up.

---

<div class="post-metadata">

**Author:** ![Joe.Charpentier](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/joe.charpentier/32/49617_2.png) [@Joe.Charpentier](https://forum.dynamobim.com/u/Joe.Charpentier)\
**Post date:** [August 15, 2018, 3:59pm UTC](https://forum.dynamobim.com/t/import-python-script/24808/12 "2018-08-15T15:59:17Z")

</div>

Disclaimer: I have not tried this, I know very little about Python, and have absolutely no idea what the changes in Syntax are from Python 2(.7) to 3(.4)

A quick google search for “port python syntax 3.4 to 2.7” returns this link, which seems like it might help you:

> **[3to2](https://pypi.org/project/3to2/)**
>
> Refactors valid 3.x syntax into valid 2.x syntax, if a syntactical conversion is possible

Good luck!
