I am looking for a way to alter the default python environment generated by the text editor or the console. I want to add commonly used modules so that I don't have to import them every time. This doesn't seem to be possible with an add-on, as described here:
https://docs.blender.org/manual/en/latest/advanced/scripting/addon_tutorial.html
or a startup script, as described here:
https://docs.blender.org/api/current/info_overview.html
but maybe I am doing something wrong.
Background: in Maya, there's a user script which is executed (not imported) at startup. If you import modules in that script, they're available from the root namespace via the text editor and console.
I am looking for similar function, due to the text editor content not being independent of the scene, and getting wiped on each new scene or session. Relevant commands need to be either retyped, saved as part of the "startup file", or pasted from some external file every single time. None of these are workable.
Working from an external editor in this context is problematic, as well. When prototyping and learning, I interact directly with the session, incrementally and piecemeal, but in more than single line increments as are available in the console. This would be difficult or impossible to do fluidly with an external editor, at least in the same way as it works in maya.
bpy
for debugging, since the same module's accessible from most places. $\endgroup$