Longtime Maya TD making the transition -- scripting workflow questions


I am an experienced Maya TD, and I’ve been learning and enjoying making the transition to Blender in my newfound COVID19 downtime. I am blown away with the project, and kicking myself for not getting into it years ago.

There is some scripting related quality-of-life tooling in Maya which I am missing in Blender. If anyone has done much scripting in Maya, they’ll know what I mean.

The first is persistence. The maya script editor has an infinite number of tabs, and they all persist across sessions. They are constantly being saved in the background.

I am aware of the function file>defaults>save startup file, but this isn’t exactly right, because it only saves the contents of one script panel, and it also saves a lot of other stuff about the current scene which I don’t want saved. Looking at the source for this, I can probably extend it to do what I want, but I don’t want to bother if someone already has, which seems likely.

The second, which is probably more tricky, is the ability to execute a block of text which is highlighted in a script editor. Basically, if you execute the run command in a script editor with nothing selected, it will run everything. If you select a block, it will only run that highlighted region. This I am missing even more. It creates the ability to very quickly assemble components of a program into syntactical order, without having to worry about the rest of the contents of a window.

If anyone has implemented something like these, or if there is a way in blender to do this, I’d be very grateful if you told me.



Welcome! regarding your first point. In Blender it’s more likely that you have your own custom startup-scripts or an add-on which is enabled at load time.
Then you can use whatever IDE/editor you like outside of Blender, reloading scripts can be assigned to a shortcut and will reload the add-on (Blender -> System -> Reload Scripts).

Your second suggestion seems like something that fits a macro system, are you using this with Python in Maya?

Running only the selected text is not an issue to implement, however Python often relies on imports which are typically at the top of a file.

We could scan the buffer for imports, run them, then run the selected code, but this seems error prone as imports don’t necessarily follow a strict pattern.

An alternative could be that running only the selected text uses the name-space of the last execution, so you would need to run the imports at some point, this has the down-side that script authors would need to be aware of the name-space between executions, it could be confusing, or you might accidentally use a variable which is later removed, causing the script to fail on restarting Blender.


Hey thanks for the quick reply.

As for the former–yup I am aware that I can take the work outside the application. However, it’s slower. It’s a step above the pure python interface (which I greatly enjoy and wish Maya had), and a step beneath encapsulating stuff neatly into modules. It’s for storing snippets of code. It’s probably more useful in an actual production environment like I am accustomed to working in, but once you’ve worked this way, it’s difficult to see working without it. And also, once you start executing chunks of code in the way described with highlighting, it ends up being just a very fast way to work. Anyway, if it hasn’t been done, I can cobble something together from the save startup file function, I think.

The second bit is indeed implemented both in python and MEL in maya, although the environments are different in many ways, MEL not being very oo. The scoping of all code executed within the application is global, so it’s a lot like a python interface which just doesn’t go away after you execute it. This applies across tabs–if I import a module in one tab, it’s imported everywhere.

Thanks again for your thoughts! I’m pretty keen on this whole thing.

I second that. It would be nice to have buffers that get saved with the over all preferences so they can be accessible from all the scenes.
Also, running only the selected lines instead of commenting in and out code is a huge time saver.


To increase productivity and quick iterations, I found useful to create a sandbox addon in which you add your snippets of code in operators that can be quickly defined and made accessible to Blender.
Also I recommand coding this sandbox addon with VSCode and the extension https://github.com/JacquesLucke/blender_vscode. You can run blender from the extension, and configure it so that it automatically reload your addon on save, which also increase productivity substantially IMHO. Coupled with the possibility of running blender debug sessions from VSCode, I think it is a pretty solid developper environnement.
So out of the box I aggree that coding in Blender is less efficient than in Maya, but with a bit of setup you can quickly make your developper environnement far more flexible and convenient.


Hi Laurent,

Thanks for the pointers. I will be sure to give them a try!


1 Like

There’s a collaboration thread over on Blender Artists that has a lot of add-ons for enhancing blender’s Text Editor. It’s somewhat long but definitely worth perusing.


Thanks, I will definitely look at that and maybe offer some thoughts.

Edit: Is this true?

“as Blender devs no not endorse any further development of it.”

That’s a shame, as it is really missing some essential features.

1 Like

You have to get pretty far down in the thread to see, but yes that’s basically the way things stand right now.



1 Like

The statements quoted should not be read too negatively.

  • Not spending a lot of developer time on something doesn’t mean it’s being abandoned or ignored.
  • Not having developments planned doesn’t mean improvements won’t be made or accepted.

There are areas of the text editor which can definitely be improved and where development is welcome.

For example, it would be nice if Python could hook into auto-complete, more easily access the selected text, … so add-on developers could more easily develop extensions.

There is some limit though, where making Blender’s text editor into a full IDE takes time away from other areas of Blender, as it’s not our intention to compete with advanced editors/IDE’s at the moment.

1 Like

There’s a great Blender Development addon for VS Code made by Jacques Lucke, who is currently a part of Blender development team. Yes, it still does “take the work outside the application” but I’d argue it’s not any slower. The fact that VS Code is actual full fledged yet lightweight IDE helps with writing Python scripts a great deal. And thanks to the aforementioned addon, you are no longer required to manually reload the scripts using the reload scripts feature, but instead they are automatically reloaded every time you save your script file in VS Code. So the VS Code ends up being hooked to Blender as a live session, and you can even utilize its debugging tools attached live with Blender running.

Overall, the way proper IDE allows you to browse and edit Python code, especially if you have script/addon which utilizes more than just a single file is superior compared to Blender’s text editor, which is really just that, a glorified notepad :slight_smile: