# How To Load A Script Again Without Restart Maya?

**URL:** https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808
**Category:** Maya
**Tags:** python
**Created:** [November 20, 2008, 2:16pm UTC](https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808 "2008-11-20T14:16:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![beast0815](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/b/22d042/32.png) [@beast0815](https://forum.highend3d.com/u/beast0815)
#### Post date: [November 20, 2008, 2:16pm UTC](https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808/1 "2008-11-20T14:16:46Z")

</div>

Hello,

when I run my Python script in Maya and expect for example an error. After I’ ve edit it I have to restart Maya because Maya doesn’t notice the modification and run the old script. How can I say Maya to load the new script without a restart? I tried to clear the History and the Input and import the script again but nothing happened.

Thanks for help

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [November 20, 2008, 8:04pm UTC](https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808/2 "2008-11-20T20:04:34Z")

</div>

not maya issue standard python stuff, read something like:

[http://www.ibm.com/developerworks/library/l-py-fly.html](http://www.ibm.com/developerworks/library/l-py-fly.html)

should give you a idea.

---

<div class="post-metadata">

### Author: ![masternull](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@masternull](https://forum.highend3d.com/u/masternull)
#### Post date: [November 20, 2008, 8:18pm UTC](https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808/3 "2008-11-20T20:18:44Z")

</div>

let’s say you have the script myScript.py in witch you have the function doStuff()

simply do this in the maya command line:

import myScript  
reload(myScript)

myScript.doStuff()

drag this in a shelf… now you simply have to edit the script in a real editor (ultraedit, wingIDE, eclipse, etc)  
save the file in the external editor

press the shelf button

![]()

enjoy

---

<div class="post-metadata">

### Author: ![beast0815](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/b/22d042/32.png) [@beast0815](https://forum.highend3d.com/u/beast0815)
#### Post date: [November 21, 2008, 11:37am UTC](https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808/4 "2008-11-21T11:37:47Z")

</div>

Thanks a lot it works. I have not used the reload() function.

My way was:

import myScript  
instanceOfClass = myScript.myScript()  
instanceOfClass.doSomething()

The shelf is a verry comfortable idea ![]() .

---

<div class="post-metadata">

### Author: ![masternull](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@masternull](https://forum.highend3d.com/u/masternull)
#### Post date: [November 21, 2008, 2:51pm UTC](https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808/5 "2008-11-21T14:51:07Z")

</div>

also note that if in your main script you are importing a second script. It might be useful to import and reload both scripts in the maya shelf to be sure everything is up to date. Even when you are only calling the first script in Maya

---

<div class="post-metadata">

### Author: ![beast0815](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/b/22d042/32.png) [@beast0815](https://forum.highend3d.com/u/beast0815)
#### Post date: [November 21, 2008, 3:04pm UTC](https://forum.highend3d.com/t/how-to-load-a-script-again-without-restart-maya/48808/6 "2008-11-21T15:04:38Z")

</div>

![]() yes I’ve noticed it.

Thank you
