I
I
Ilya2020-12-13 13:11:42
Python
Ilya, 2020-12-13 13:11:42

How to call a function from another script in python discord.py?

Hello everyone, I would like to know how to call functions in the discord.py bot from another script.
I would like to do this:
We have a "main.py" script - it has a "go(arg)" function. arg is the content of text.txt. And I would like to send this content to some discord channel (a specific channel id).
Any help is welcome

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2021-12-12
@stead

@client.event
async def on_ready(): 
  channel = client.get_channel("your channel id")  
  await channel.send("your message")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question