SAFR Actions runs scripts as the Administrator account on Windows and as the 'safr' account on Linux and macOS. However, when you run your script from the terminal, you're probably running as a different account.

Check that your Python script has all the required modules when run as the system administrator in Windows, and as the 'safr' user when run in Linux or macOS.  Also check other differences as described in Script does not work when run by SAFR Actions.