# Blender doesn't run my script unless blender crashes?

I have the most unusual and frustrating issue at the moment. I've got a script, but I just can't get it to run. I've tried live edit, not live edit, using the run script button with and without the register check box. I've even tried starting a new blend file and importing everything as a proper add-on. None of them work.

BUT, if for what ever reason, blender crashes, (which it is doing quite a lot at the moment... (I'm running the macOS Sierra beta which I probably shouldn't have done), then the script updates, and runs perfectly. It's just so impossible to use right now.

• Can you post the script? – Todd McIntosh Jul 17 '16 at 6:44
• Might need the macbook.blend file too. Slight note, when context is passed to a class method eg draw(self, context): use that ( obj = context.object) rather than obj = bpy.context.object. Without aforementioned file, my guess is that it's a lost reference. – batFINGER Jul 17 '16 at 7:32
• @batFINGER Are you sure about the .blend file? I'm intending on selling this and I'd rather not redistribute the files. As for the other part, I don't quite understand, which parts are you referring to? – mr-matt Jul 17 '16 at 8:09

It sounds like you have a bug in your script. Run blender from the command line, and it will tell you what the error is there.

Update: I found that node in your code in the beginning of it, you have a several lines that say s_slots[0].material.node_tree.nodes['S_R_MS'].inputs[0].default_value = 0.0 I suspect that is where the S_R_MS node is.

• Well we're getting somewhere now, it gives me this error: "Error, couldn't find thumbnail for Theatrical lighting" No idea what this could be, do you know? – mr-matt Jul 17 '16 at 19:16
• Ok, I found it, it's an icon from the Pro Lighting Studio add-on. I was lucky enough to be a beta tester on that so I'm now thinking that something may have slipped through... – mr-matt Jul 17 '16 at 19:20
• Ok, now I know somethings up. When I change the enum in the UI, it gives me an error saying the node 'S_R_MS' could not be found. That would be because I have since removed that node, but I have also removed that from the code and replaced it with something else, it doesn't seem to be updating... – mr-matt Jul 17 '16 at 19:36
• Can you upload your .blend? (If you want to sell this, you might not want to upload it, but then I can't help you.) – Billy S Jul 17 '16 at 19:37
• On the account that you don't redistribute it! – mr-matt Jul 17 '16 at 19:37

I realised that it was really simple. The two lines at the bottom of the script were commented out:

if __name__ == "__main__":
register()


Uncommenting them did the trick.