Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am making a script that will call another script in the same folder, but when I convert the script that's calling it doesn't work.

What I have tried:

I have tried different ways of converting, and calling scripts differently but nothing works. This is the code, thanks:
Python


from time import sleep
import random
import keyboard
import os.path

h = 0.1
o = random.randint(1, 10)
with open('quitkey.txt') as f:
        lines = f.readlines()
with open('hotkey.txt', 'r') as file:
    data = file.read().rstrip()
if data == 'a':
    hotkey = 'a'
if data == 'b':
    hotkey = 'b'
if data == 'c':
    hotkey = 'c'
if data == 'd':
    hotkey = 'd'
if data == 'e':
    hotkey = 'e'
if data == 'f':
    hotkey = 'f'
if data == 'g':
    hotkey = 'g'
if data == 'h':
    hotkey = 'h'
if data == 'i':
    hotkey = 'i'
if data == 'j':
    hotkey = 'j'
if data == 'k':
    hotkey = 'k'
if data == 'l':
    hotkey = 'l'
if data == 'm':
    hotkey = 'm'
if data == 'n':
    hotkey = 'n'
if data == 'o':
    hotkey = 'o'
if data == 'p':
    hotkey = 'p'
if data == 'q':
    hotkey = 'q'
if data == 'r':
    hotkey = 'r'
if data == 's':
    hotkey = 's'
if data == 't':
    hotkey = 't'
if data == 'u':
    hotkey = 'u'
if data == 'v':
    hotkey = 'v'
if data == 'w':
    hotkey = 'w'
if data == 'x':
    hotkey = 'x'
if data == 'y':
    hotkey = 'y'
if data == 'z':
    hotkey = 'z'
while True:
    
    if keyboard.is_pressed(lines):
        quit()
    if keyboard.is_pressed(hotkey):
        if o == 1:
            os.system('techneverdies.py') 
        if o == 2:
            os.system('blood.py') 
        if o == 3:
            os.system('nec.py') 
        if o == 4:
            os.system('hesitate.py')
        if o == 5:
            os.system('sd.py')
        if o == 6:
            os.system('orphans.py')
        if o == 7:
            os.system('trib.py') 
        if o == 8:
            os.system('hil.py') 
        if o == 9:
            os.system('ego.py') 
sleep(h)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900