The answer is the following:
I had installed trytond in a folder outside my virtual environment folder (so I could keep the customized modules separate, and the rest of the stuff in the env… folder).
When I opened Spyder (my IDE) in that virtual environment, I had to set my working directory to the trytond installation folder (outside the virtual env.) for it to work properly.
@ced For completeness, I should have said that I am running the following code: