Aleks wrote: ↑Thu Apr 20, 2023 3:22 pm
Adding 'usr/lib/freecad/Mod' to path did the trick. I also vaguely understand why it needed to be added. it works now.
Happy to hear I've guessed right.
Python path is populated correctly if you use freecadcmd, as it initialize FreeCAD and probably one action is setting path correctly pointing to Mod directory and even user/Mod directory too.
If you use it from a foreign interpreter (asa library) probably the init part is not executed when you issue
so you have to add all the directory manually or maybe check if they are already added.
I use this code with multifile scripts to avoid multiple path imports when developing, as at first start script directory is not in the path, but appending it multiple times is not very clever.
Code: Select all
if PATH in sys.path:
pass
else:
sys.path.append(PATH)
Hoping to have remembered code right (I'm far from a computer).
A little note, I use AppImage so FreeCAD python interpreter version is usually not the same as system version and it is "sort of" isolated from the system, I'm using a distribution supplied version (except for adrianinsaval Arch Linux version I use for FreeCAD-dev).
Regards
Carlo D.