# Scripting Live-Link 📜

**URL:** <https://blenderartists.org/t/scripting-live-link/1182392>\
**Category:** Released Add-ons and Extensions\
**Created:** [September 26, 2019, 12:29am UTC](https://blenderartists.org/t/scripting-live-link/1182392 "2019-09-26T00:29:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 26, 2019, 12:29am UTC](https://blenderartists.org/t/scripting-live-link/1182392/1 "2019-09-26T00:29:04Z")

</div>

Hello guys.

I really like working in sublime but there’s no link right now so i elaborated an universal “Script Live-Link”

it can work with any note editor what so ever, the goal is to facilitate development of scripts and addon within blender for peoples who use different text editors.

here is the project:

[https://blenderartists.org/uploads/default/original/4X/6/0/4/604eb9928d7da5d7d95b4cc8f210e6df49ce2e67.mp4](https://blenderartists.org/uploads/default/original/4X/6/0/4/604eb9928d7da5d7d95b4cc8f210e6df49ce2e67.mp4)

> - You can choose up to 3 scripts paths at the time in the text editor T panel.

> - Once the python script path is choosed, an execute script operator will be at your disposal. (click on the operator for an direct manual execution).

> - You can create a livelink:
> - If “`EXECUTE`” is in the first line of your script, every time you save the script, it will automatically run inside of blender. it can also work with `if __name__ == " __main__": register()` which is nice for working on addons.
> 
> - If “`#EXECUTE_CUSTOM`” is in the first line of your script, every time you save the script, it will automatically create(/overwrite) a new file with the line between `#EXECUTE_START` and `#EXECUTE_STOP` then run it in blender. see examples [here](https://blenderartists.org/t/scripting-live-link/1182392/10)  
> if you choose the `#EXECUTE_CUSTOM` method, don’t forget your boundaries. as the script will be empty otherwise.
> 
> - If `#STOP` is in the first line of your script, the live-link will stop.
> 
> - **Always keep an text editor open in the blender main layout otherwise the link will not work.** i suggest you tu use a set up like this below
> 
> > **Suggested use. always keep an text edito open**
> >
> > ![Annotation%202019-09-30%20151234](https://blenderartists.org/uploads/default/original/4X/9/9/9/999479a0e4681bb88ef2f0d5a9ea6b607f266d3d.jpeg)

> - There’s also an addon reloader operator, handy to update the code of your addon directly into blender if `if __name__ == " __main__": register()` method won’t work for you. You just need to set the path of the addon you are working on. i only support “one `.py` file” addon type. let me know if you’d like a full folder to zip & install automation

## [Script-LiveLink\_V21.py](https://blenderartists.org/uploads/short-url/9inYK0PKR27xQ7xt8lzBxH2MsRL.py) (23.3 KB)

> **Old Version**
>
> [Script-LiveLink\_V8.py](https://blenderartists.org/uploads/short-url/8SteiGNgV4X7DOyO0oZaGLSdJz.py) (16.0 KB)  
> [Script-LiveLink\_V17.py](https://blenderartists.org/uploads/short-url/yMnDIFM04NvMuRd4rmpBxRPDnIj.py) (21.3 KB)  
> [Script-LiveLink\_V19.py](https://blenderartists.org/uploads/short-url/3VZJ5vjaCbhyyncb80mTdDv4aUn.py) (19.7 KB)

> **Quick start guide**
>
> > 1. install the Script-LiveLink.py
> > 2. Set up a text editor in your main layout (Keep it always open when using the addon)
> > 3. use CTRL+T to open the T panel, and go in my addon tab
> > 4. choose your script path in one of your 3 path slots, then click on "Start LiveLink.
> > 5. if #EXECUTE or #EXECUTE\_CUSTOM is in the first line of the script, everytime you save the him it will automatically it will be automatically executed within blender.

> **Help! my live-link doesnt work!**
>
> > if the script link is not working for you. please read above. but here a quick check-up:
> > 
> > - at the first place, is your script working witouth the addon ? try it out in a text editor.
> > - is the link on ? if it’s a brand new blender session and you forgot to close it last time, you will need to stop and re-start the link. is #EXECUTE in your first line ?
> > - Did you use #EXECUTE\_CUSTOM witouth any boundaries ?
> > - did you leave an text editor always open as i suggested above ?
> > - do you [Ctrl+S] shortcut from your text editor actually save ondisk ?
> > - you can try to check if the live-link is properly working with the debug mode (checkbox below) it will print all important event, timers and handlers activities.

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 27, 2019, 11:59am UTC](https://blenderartists.org/t/scripting-live-link/1182392/4 "2019-09-27T11:59:38Z")

</div>

Hopefully jacque lucke will find a solution for the #EXECUTE problem.

> **[How to run a script from outside Blender? \[Script Live-Link Addon\]](https://devtalk.blender.org/t/how-to-run-a-script-from-outside-blender-script-live-link-addon/9792/2)**
>
> @jacqueslucke can you help here, please? Thank you.

---

<div class="post-metadata">

**Author:** ![Elreenys](https://blenderartists.org/user_avatar/blenderartists.org/elreenys/32/606282_2.png) [@Elreenys](https://blenderartists.org/u/Elreenys)\
**Post date:** [September 27, 2019, 9:12pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/5 "2019-09-27T21:12:14Z")

</div>

Thanks for your hard work.

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 28, 2019, 2:08am UTC](https://blenderartists.org/t/scripting-live-link/1182392/6 "2019-09-28T02:08:14Z")

</div>

Hey thanks !  
but you can thank me once we got the `#EXECUTE` feature working.

---

<div class="post-metadata">

**Author:** ![Elreenys](https://blenderartists.org/user_avatar/blenderartists.org/elreenys/32/606282_2.png) [@Elreenys](https://blenderartists.org/u/Elreenys)\
**Post date:** [September 28, 2019, 3:30pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/7 "2019-09-28T15:30:00Z")

</div>

Ok i will.😉

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 29, 2019, 4:11pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/8 "2019-09-29T16:11:31Z")

</div>

i cracked the #execute problem with the help of kiao. im using it for my scripts right now. it’s god damn powerful. i hope the blender institute will let me make this addon official. it make a kinda universal link with any other script editor. (there’s just the step of finding script path which is annoying).

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 30, 2019, 11:02am UTC](https://blenderartists.org/t/scripting-live-link/1182392/9 "2019-09-30T11:02:31Z")

</div>

Okay. Finished.

> UPTDATE

> - ` #EXECUTE` is now working perfectly, with 3 scripts live-linked simultaneously.
> - It can not work with addon `if __name__ == " __main__": register()` which is really nice for working on an addon.

> - if your addon is too complex to be used with `if __name__ == " __main__": register()` you may directly register it inside of blender with the _addon realod_ operator.
> - personally i’m not working with .zip format with multiples scripts for one addon. so right now this operator will only work for one file `.py` addon format. Please let me know if `.zip` support important for you. i think i can automate a whole folder to `.zip` + auto addon reg.

> - **i dropped the .blend text editor live link.** as it is totally useless. i get that it’s cool but i find not utility in this. It’s worth nothing now that `#EXECUTE` is here. If you don’t agree with that let me know.

> - you have now the possibility of executing only some part of your script. for example:
> - `#EXECUTE[5]` will only execute line 5
> - `#EXECUTE[5:55]` will only execute lines 5 to 55
> - `#EXECUTE[5:10][15:16][36]` will only execute lines 5 to 10 + 15 to 16 +36
> 
> This is really useful. i tested it myself, as there’s no need to use a whole new file to do some testing.  
> it will also generate a `ScriptName_script_cut.py` file. let me know if i should automatically delete him after execution.

I could do an alternate way of doing this like `#EXECUTE BELOW` and `#STOP` directly inside of the script ? what do you think ? is this better ? i think i’ll do that right now. ?

## [Script-LiveLink\_V17.py](https://blenderartists.org/uploads/short-url/yMnDIFM04NvMuRd4rmpBxRPDnIj.py) (21.3 KB)

i had some def attribute problem in the script so there’s some horrible def repetition. it was kind of tricky to get one def working for the three custom slots at the same time. so i had to made one def per slot which is stupid. but well it is working. #don’t judge me please

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 30, 2019, 12:38pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/10 "2019-09-30T12:38:08Z")

</div>

> UPDATE

I Replaced the custom execution system !

if `#EXECUTE_CUSTOM` is in the firsl line instead of simply `#EXECUTE` it will only execute lines between `EXECUTE_START` and `EXECUTE_STOP`

## here’s some examples:

* * *

* * *

* * *

**Example Script 1=**

```auto
#EXECUTE
print(1)
print(2)
print(3)

```

Output:

```auto
1
2
3

```

* * *

* * *

* * *

**Example Script 2=**

```auto
#EXECUTE_CUSTOM
print(1)
#EXECUTE_START
print(2)
#EXECUTE_STOP
print(3)
print(4)
#EXECUTE_START
print(5)

```

Output:

```auto
2
5

```

* * *

* * *

* * *

`#EXECUTE_START` can also crop indentation for you

**Example Script 3=**

```auto
#EXECUTE_CUSTOM
def my_super_complex_def():
   if blabla == True:
       if 'hello' not in manywow:
           #EXECUTE_START
           print('very')    
           print('wow')    
           print('such')    
           print('handy')
#EXECUTE_STOP

```

Cutted script file will be this:

```
print('very')    
print('wow')    
print('such')    
print('handy')

```

Output:

```auto
very
wow
such
handy

```

* * *

* * *

* * *

Keep in mind that all the modules, def, and defined objects will not magically be working if not within the boundaries of the custom execution.

```auto
#EXECUTE_CUSTOM
import bpy
C = bpy.context
name = "Monkey"
print(4)
print(5)
#EXECUTE_START
C.object.name = name
#EXECUTE_STOP
print(3)
print(4)
print(5)

```

Output = `Error`

* * *

* * *

* * *

## [Script-LiveLink\_V19.py](https://blenderartists.org/uploads/short-url/3VZJ5vjaCbhyyncb80mTdDv4aUn.py) (19.7 KB)

---

<div class="post-metadata">

**Author:** ![Elreenys](https://blenderartists.org/user_avatar/blenderartists.org/elreenys/32/606282_2.png) [@Elreenys](https://blenderartists.org/u/Elreenys)\
**Post date:** [September 30, 2019, 2:50pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/11 "2019-09-30T14:50:39Z")

</div>

Thanks again! 🙂

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 30, 2019, 2:59pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/12 "2019-09-30T14:59:23Z")

</div>

@Elreenys let me know for potential feedbacks, do you use Sublime too ? or something else ?

---

<div class="post-metadata">

**Author:** ![Elreenys](https://blenderartists.org/user_avatar/blenderartists.org/elreenys/32/606282_2.png) [@Elreenys](https://blenderartists.org/u/Elreenys)\
**Post date:** [September 30, 2019, 3:03pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/13 "2019-09-30T15:03:45Z")

</div>

Until now, I’m using VS code, but I was looking for a solution to use sublime.

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 30, 2019, 3:06pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/14 "2019-09-30T15:06:09Z")

</div>

Cool ! let me know how you like it (both)  
i will share my library of Snippets once they are in the 50’s

---

<div class="post-metadata">

**Author:** ![Elreenys](https://blenderartists.org/user_avatar/blenderartists.org/elreenys/32/606282_2.png) [@Elreenys](https://blenderartists.org/u/Elreenys)\
**Post date:** [September 30, 2019, 3:38pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/15 "2019-09-30T15:38:35Z")

</div>

It’s definitively my fav addon ❤  
Just one thing, you should add an how to install it in text form, the video is a bit fast.

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 30, 2019, 3:42pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/16 "2019-09-30T15:42:09Z")

</div>

Sorry.

i will, in the meanwhile it’s really simple:

1)install the addon .py  
2)set up a text editor (always open) and go in the T or N panel. find out my addon category.  
3)just set your script path. you can set 3 scripts simultaneously.  
4) use #EXECUTE in the first line of your script and every time you save the script will be automatically run inside of blender.

---

<div class="post-metadata">

**Author:** ![Elreenys](https://blenderartists.org/user_avatar/blenderartists.org/elreenys/32/606282_2.png) [@Elreenys](https://blenderartists.org/u/Elreenys)\
**Post date:** [September 30, 2019, 3:54pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/17 "2019-09-30T15:54:04Z")

</div>

I succeed to use it but if others wants to try it, they’ll have instructions.  
It’s CTR + T in the scripting tab to open the sidebar.

---

<div class="post-metadata">

**Author:** ![kkar](https://blenderartists.org/user_avatar/blenderartists.org/kkar/32/1098492_2.png) [@kkar](https://blenderartists.org/u/kkar)\
**Post date:** [September 30, 2019, 4:40pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/18 "2019-09-30T16:40:08Z")

</div>

What is the Addon Reloader is for in the menu?

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [September 30, 2019, 4:59pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/19 "2019-09-30T16:59:08Z")

</div>

It will’ automatically de-install/re-install and enable an addon you are working on.

> [@Quickly de-install / re-install an addon for updating it's code?](https://blenderartists.org/t/quickly-de-install-re-install-an-addon-for-updating-its-code/1178999):
>
> Hello, is there a way to quickly update the code of your addon to blender ? i way thinking of doing the uninstall then reinstall the same addon with an automation. something like that should surely exist isnt it ?

---

<div class="post-metadata">

**Author:** ![kkar](https://blenderartists.org/user_avatar/blenderartists.org/kkar/32/1098492_2.png) [@kkar](https://blenderartists.org/u/kkar)\
**Post date:** [September 30, 2019, 5:00pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/20 "2019-09-30T17:00:13Z")

</div>

Thanks I will give it try.

---

<div class="post-metadata">

**Author:** ![Elreenys](https://blenderartists.org/user_avatar/blenderartists.org/elreenys/32/606282_2.png) [@Elreenys](https://blenderartists.org/u/Elreenys)\
**Post date:** [October 1, 2019, 3:03pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/21 "2019-10-01T15:03:50Z")

</div>

I have test a bit and :

- if I work on panel, there is no update (no new property is draw)
- I got this error when I try to disable the addon

Exception in module unregister(): ‘/home/elreenys/.config/blender/2.80/scripts/addons/Script-LiveLink\_V19.py’  
Traceback (most recent call last):  
File “/mnt/55197c6b-14c8-49a8-a69e-286fbfc7ebdb/Blender build/blender-2.80-linux-glibc217-x86\_64/2.80/scripts/modules/addon\_utils.py”, line 437, in disable  
mod.unregister()  
File “/home/elreenys/.config/blender/2.80/scripts/addons/Script-LiveLink\_V19.py”, line 430, in unregister  
bpy.app.timers.unregister(poll\_text1)  
ValueError: Error: function is not registered

Error: Traceback (most recent call last):  
File “/mnt/55197c6b-14c8-49a8-a69e-286fbfc7ebdb/Blender build/blender-2.80-linux-glibc217-x86\_64/2.80/scripts/modules/addon\_utils.py”, line 437, in disable  
mod.unregister()  
File “/home/elreenys/.config/blender/2.80/scripts/addons/Script-LiveLink\_V19.py”, line 430, in unregister  
bpy.app.timers.unregister(poll\_text1)  
ValueError: Error: function is not registered

---

<div class="post-metadata">

**Author:** ![BD3D](https://blenderartists.org/user_avatar/blenderartists.org/bd3d/32/900236_2.png) [@BD3D](https://blenderartists.org/u/BD3D)\
**Post date:** [October 1, 2019, 3:42pm UTC](https://blenderartists.org/t/scripting-live-link/1182392/22 "2019-10-01T15:42:41Z")

</div>

the error message is not important, it’s just that i’m trying to remove a timer something that doesn’t exist yet. I will correct that for update v20.

can i get the file that you cannot draw ? i’d like to see it for myself please, hard to tell witouth it.

[Next page](https://blenderartists.org/t/scripting-live-link/1182392.md?page=2)
