'discord one script run multiple times

Friends, I am making a discord script using python I have to run this script multiple times with different parameters, I am trying that with os, threading, multiprocessing. when I am trying with this library that works only for first data Then it stuck, My code is below, please advise me.

note:- I am login as a user.

CSV file demo

auth-token1,channel-id1-1,channelid1-2
auth-token2,channel-id2-1,channelid2-2
...
...

main.py

import os
import csv
from time import sleep
import threading
import multiprocessing
rows = []
with open('data.csv', 'r') as csvfile:
    # creating a csv reader object
    csvreader = csv.reader(csvfile)
    # extracting each data row one by one
    for row in csvreader:
        rows.append(row)

for _ in rows:
    li = _[1:]
    cmd = _[0]
    for i in li:
        cmd = cmd+" "+str(i)
    print(f'python3 script.py {cmd}')
    os.system(f'python3 script.py {cmd}')
    sleep(10)

script.py

import time
import os
import sys
from time import sleep
import os
from discord import Permissions, message
import discord
import logging
import sys

argumentList = sys.argv
print(argumentList[1:])
TOKEN_AUTH = argumentList[1]
os.environ['TZ'] = 'Asia/Kolkata'
time.tzset()

logging.basicConfig(handlers=[logging.FileHandler(filename="./discord.txt",
                                                encoding='utf-8', mode='a+')],
                    format="%(asctime)s %(name)s:%(levelname)s:%(message)s",
                    datefmt="%F %A %T",
                    level=logging.INFO)

channel = None
client = discord.Client()
ids = argumentList[2:]
sleep_time = 121
message = "enter your message"


@client.event
async def on_ready():
    global channel
    while True:
        for _ in ids:
            try:
                channel1 = client.get_channel(int(_))
                await channel1.send(message)
                logging.info('1')
                print('sleeping')
                sleep(sleep_time*60)
            except:
                client.run(TOKEN_AUTH, bot=False)

client.run(TOKEN_AUTH, bot=False)


Solution 1:[1]

It is against Discord TOS to use bot=False otherwise known as a self bot (user)

All I will say is d.py is asynchronous and parts of your code are synchronous which is blocking.

client.run() is also a blocking method which is why your main.py stops running after the first run. Everything you do, with discord bots, needs to be async and within the client loop.

I recommend you rethink exactly what you are trying to do and do something that is not breaking their Terms of Service.

Solution 2:[2]

The reason because you are using ( client.run ) , this method will block the lines after it .

if you want to send messages in any place in your code ,

check this solution ^_^ :

client.run("TOKEN") blocking issue (python & discord.py)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Mr Dream