5 #ifndef __pycppad_utils_scope_hpp__
6 #define __pycppad_utils_scope_hpp__
8 #include <boost/python.hpp>
22 namespace bp = boost::python;
25 std::string current_scope_name(bp::extract<const char*>(current_scope.attr(
"__name__")));
26 std::string complete_submodule_name = current_scope_name +
"." + submodule_name;
28 bp::object submodule(bp::borrowed(PyImport_AddModule(complete_submodule_name.c_str())));
29 current_scope.attr(submodule_name.c_str()) = submodule;
boost::python::scope scope(const std::string &submodule_name)
Helper to create or simply return an existing namespace in Python.
Definition: scope.hpp:20