I am using pybind11 to call a python built-in function like range in c++ code. But I only found way to call a function in module like this:
py::object os = py::module::import("os");
py::object makedirs = os.attr("makedirs");
makedirs("/tmp/path/to/somewhere");
But a python built-in function like range needn't import any modules, so how can I use pybind11 to call range in c++ code?
You could fetch
range
from theglobals
dict.