I have been using python for a while know but have never had this issue before. Whenever I go to create a function in my python file it doesn't give me any errors, but when I go to use the function it tells me its not defined.
Heres the code:
import pyautogui
import keyboard
import time
while True:
try:
if keyboard.is_pressed('`'):
macro('hold','w',3)
break
except:
break
def macro(type,key,seconds):
endtime = time.time() + seconds
while time.time() < endtime:
if type == 'hold':
pyautogui.hold(key)
The macro('hold','w',3) on line 8 is where the error "macro" is not defined is.
I've checked several different post but they are all different to this.
macrois defined, place the while loop aftermacro