如何执行启动另一个 python 脚本的 python 宏?

How to execute a python macro that launches another python script?

我想在 libreoffice 上创建一个 python 宏,它将触发另一个 python 脚本。不幸的是它不起作用,我不知道为什么。

当我从终端启动 python 时,它工作正常但不是从宏。

我的 macro.py 文件:

import os

def launch():
        os.system("python /home/ivq/Documents/generation.py")
launch()

预期结果:启动 generation.py
实际结果:什么都没发生

import subprocess

subprocess.call(["python", "/home/ivq/Documents/generation.py"])

应该帮忙吗?