我希望 Discord 机器人使用命令编写另一个 python 脚本输出

I want Discord bot to write another python script output with comand

我确实构建了一个不和谐的机器人,我想添加一个命令 运行 并读取 python 中的另一个脚本输出 我该怎么做? 这是我在 discord

上的新机器人
import discord
from discord.ext import commands, tasks

import discord
from discord.ext import commands, tasks
from itertools import cycle

flashing = commands.Bot(command_prefix='.')

@flashing.command()

async def ping(ctx):
    await ctx.send(f'Pong! {round(flashing.latency * 1000)} ms' )
    print('bot is ready.')

@flashing.event
async def on_ready():
    change_status.start()


flashing.run('token')

另一个脚本名称是base_script.py

假设两个脚本在同一个文件夹中:

#scripts.py
def Some_Code():
    #Put all of scripts.py code in this function
    return(Variables)
    #make sure to return all variable that you want to read in your other file

假设您已经像这样设置了 scripts.py,剩下的就很简单了:

import scripts
print(scripts.Some_Code())