diff options
Diffstat (limited to 'source/blender/python/intern/bpy.c')
-rw-r--r-- | source/blender/python/intern/bpy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 8076515b94b..02073f368e8 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -53,6 +53,8 @@ #include "AUD_PyInit.h" +PyObject *bpy_package_py= NULL; + static char bpy_script_paths_doc[] = ".. function:: script_paths()\n" "\n" @@ -161,7 +163,7 @@ static PyMethodDef meth_bpy_script_paths = {"script_paths", (PyCFunction)bpy_scr static PyMethodDef meth_bpy_blend_paths = {"blend_paths", (PyCFunction)bpy_blend_paths, METH_VARARGS|METH_KEYWORDS, bpy_blend_paths_doc}; static PyMethodDef meth_bpy_user_resource = {"user_resource", (PyCFunction)bpy_user_resource, METH_VARARGS|METH_KEYWORDS, NULL}; -static void bpy_import_test(const char *modname) +static PyObject *bpy_import_test(const char *modname) { PyObject *mod= PyImport_ImportModuleLevel((char *)modname, NULL, NULL, NULL, 0); if(mod) { @@ -170,7 +172,9 @@ static void bpy_import_test(const char *modname) else { PyErr_Print(); PyErr_Clear(); - } + } + + return mod; } /***************************************************************************** @@ -235,5 +239,5 @@ void BPy_init_modules( void ) PyModule_AddObject(mod, meth_bpy_unregister_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_unregister_class, NULL)); /* add our own modules dir, this is a python package */ - bpy_import_test("bpy"); + bpy_package_py= bpy_import_test("bpy"); } |