'I have a main.py and execute some programs progrma with schedule always work but others dont
main.py
import schedule
import time
import tweepy
from binance.client import Client
import functions as func
import signal_func as signals
import time
import key
import send_msg as tele
func.server_online2()# this is a code I want to run in main py
signals.signal.py # this code always work if not execute also work I put if main function but not work
signal_func.py
def signal():
code here
schedule.every(15).seconds.do(signal)
while True:
schedule.run_pending()
if __name__ == "__main__":
signal()
Solution 1:[1]
I'm not much of an expert in Python, but I think the print statements slow down just a bit for it to work, because obviously when you remove the print statements it goes crazy. So I think you might need to keep the print statements for it to work.
I tested out the following code, which gets rid of the print statements:
import mouse
import asyncio
last_pos = mouse.get_position()
def on_move(event):
global last_pos
if isinstance(event, mouse._mouse_event.MoveEvent):
new_pos = ((last_pos[0] - event.x) * 2, (last_pos[1] - event.y) * 2)
asyncio.sleep(0)
mouse.move(*new_pos, absolute=False)
last_pos = mouse.get_position()
mouse.hook(on_move)
input('Press enter to stop...')
^^ I think this works just as well ( or better ) but I don't know if its recommended.
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 |
