[det]py_module(+Module:atom,
+Source:string)Load Source into the Python module Module. This is
intended to be used together with the string
quasi
quotation that supports long strings in SWI-Prolog. For example:
:- use_module(library(strings)).
:- py_module(hello,
{|string||
| def say_hello_to(s):
| print(f"hello {s}")
|}).
Calling this predicate multiple times with the same Module
and
Source is a no-op. Called with a different source creates a
new Python module that replaces the old in the global namespace.
- Errors
python_error(Type, Data)
is raised if Python raises an
error.