yuce / pyswip

PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.
https://pyswip.org
MIT License
472 stars 97 forks source link

use_module support #118

Closed LyzardKing closed 1 year ago

LyzardKing commented 3 years ago

Hi @yuce Is it possible to add modules (via use_module)? As I would do in prolog: :- use_module('module', [ predicate/2 as new_predicate ]).

allComputableThings commented 3 years ago

Have you tried:

module_name = 'foo'
prolog.query(f"use_module(library({module_name}),[])")