 py_shell
py_shelljanus as below.
from janus import *
So, we can do
?- py_shell.
...
>>> query_once("writeln(X)", {"X":"Hello world"})
Hello world
{'truth': True}
If possible, we enable command line editing using the GNU readline library.
When used in an environment where Prolog does not use the file 
handles 0,1,2 for the standard streams, e.g., in swipl-win, 
Python's I/O is rebound to use Prolog's I/O. This includes Prolog's 
command line editor, resulting in a mixed history of Prolog and Pythin 
commands.