I have a set of tools that I use with blender and wanted to know how can I pre-import this module into blender's python console and have it accessible all the time. Just like how bpy works and I don't need to import every time I'm opening the program.
At startup, Blender reads the contents of the
scripts/startup/ directory for python modules and imports them. You can also choose to use scripts as add-ons (turn on/off via Add-Ons manager):
Around line 97 in
scripts\modules\console_python.py, there is some code regarding the imports / convenience variables:
namespace["__builtins__"] = sys.modules["builtins"] namespace["bpy"] = bpy # weak! - but highly convenient namespace["C"] = bpy.context namespace["D"] = bpy.data
It doesn't work however if you add
import bmesh; namespace["bmesh"] = bmesh here.
Maybe this code isn't really used, you might wanna check the C code.