Calling AppleScript routine using osascript
Found a workaround. Not clean, but it works. In my case with Python:
import subprocess
    
with open(&quot;script.scpt&quot;) as applescript:
    subprocess.run([&quot;/usr/bin/osascript&quot;, &quot;-e&quot;, f&quot;{applescript.read()}\nmyHandler()&quot;])````