Execute Python Script Add On

Hi,
This is my first post to this forum. Over 10 years ago I used to use modo and wrote some scripts for it but never released them. I’ve been desperately wanting to do some visualizations and I’ve played with Blender so I decided to dive in more.

My first problem is I love using an external editor and it was awkward. So I eventually decided to write a script add on that allows me to connect a hotkey to running my script. In researching this, I did see someone else has an add on that runs scripts, but I didn’t look at it. :face_with_peeking_eye:

My script looks in the folder of the blend file and if it finds a file with the same name but with the .py extension, it runs it. If that isn’t there, it checks bpy.data.texts for the same name and will run it if found. If that’s not there, it checks if bpy.data.texts[0] exists and runs that. Maybe it shouldn’t? Or maybe it should only run it if it ends in .py? I put that code there anticipating how others might want to run it because I wont use that bit of code.

I also added a menu item to the bottom of the Render menu, which is the wrong spot, I know. I just don’t know where to put it so it’s always available. I should probably also auto create a hotkey, but I’m not sure what to choose. I prefer ctrl-alt-x (for execute).

Anyway, this is a good first contribution and I thought others might like it so I put it on GitHub. https://github.com/magnusviri/blender_scripts/

1 Like