In Pyrogram package, how can I call a function from another Python script?
For example, suppose that the Pyrogram function takes two arguments chat_id
and text
as input and then send text
to given chat_id
.
We know that app.send_message(chat_id = given_chat_id,text = given_text)
method is send given_text
to given_chat_id
,
Suppose there are two files named run.py
and tel.py
in the same folder.
File run.py
should contain this script:
from tel import my_func
my_func(given_chat_id, given_text)
and tel.py
should look like this code:
from pyrogram import Client
app = Client("my_account")
async def my_func(chat_id, text):
print("Hello world!")
await app.send_message(chat_id, text)
app.run()
We know it doesn't work. when I run run.py
file Even the phrase Hello world!
is not printed.
I don't know how to call it.