I'm trying to compare variables in other python files, but I can't compare them

Asked 2 years ago, Updated 2 years ago, 44 views

#test.py
NOW_TIME = "23:35:00"
#Discord.py
import discord
from discord.ext import commands
from discord.utils import get
import datetime
import asyncio
import time
import load_json_variable as variable
import test
import Timetable as ttb

class MyClass:
    TimetableStop = False
    tn = datetime.datetime.now()
    st = tn.strftime("%H:%M:%S")
    pass

#... a heavy policy
@bot.command(name="test2")
async def react_test2(ctx):
    MyClass.TimetableStop = True
    Read as wait send(ctx, test.NOW_TIME+".")
    while stop:
        await asyncio.sleep(1)
        timeSet()
        if MyClass.st == str(test.NOW_TIME):
            wait send(ctx, "py file read successfully.")
            break
        elif not MyClass.TimetableStop:
            break

I've imported it properly Await sends (I read it as cx, test.NOW_TIME + ") is also called well.

 if str(st) == str(test.NOW_TIME):
            wait send(ctx, "py file read successfully.")
            break

This part doesn't work. What should I do?

If you need the full code, I'll give it to you.

if문

2022-09-20 17:03

1 Answers

Must be the value of a return to

like this?

#test.py
def NOW_TIME():
    return "23:35:00"


2022-09-20 17:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.