Nested Query

Hi,

I am calling one Prolog function which returns a list. I traverse the list using a Python loop and do somethings. In the same loop, when I catch a specific condition, I call another Prolog function. I tried to execute this code with a single prolog object but got

“pyswip.prolog.NestedQueryError: The last query was not closed”

error. Later, I decided to use a second prolog variable for inner queries. Even, having two totally independent prolog objects (each having its own assertions and consultation calls), I am still getting the same error. Can somebody show me how to do this?

Many thanks, Ferda

This is also posted on StackOverflow.
This is also talked about in this reply of another topic.