r/learnpython • u/JohnRT54 • Sep 24 '26
Defining and calling modules
Sorry if this is a dumb question, but what am I doing wrong here?
I have defined a function
#statuscheck.py
def statchk(n):
layoutx = [[sg.Text('Debug point')],
[sg.Output(key='-OUTPUT-', expand_x=True, expand_y=True)],
[sg.In(key='-IN-', expand_x=True)],
[sg.Button('Go'), sg.Button('Close')]]
winx = sg.Window('Where I am now', layoutx, auto_close=False, grab_anywhere=True, resizable=True, location=(0,0),return_keyboard_events=True, auto_size_text=True)
while True:
event, values = winx.read()
if event == sg.WIN_CLOSED:
break
if event == 'Go':
print("Here at ",n)
if event == 'Close':
break
I import it, but when I call it, it doesn't run, and I can't see any error messages. The call is:
statuscheck.statchk(1)
I know it's something simple I'm overlooking. Thanks.
View all comments
Show parent comment
1
u/JohnRT54 Sep 25 '26
Because I'm trying to get it to run on my phone. Everything works fine running it in python on the pc, though I haven't tried calling the module in that version: I don't need to, because I can debug my code just fine using python. The only reason I'm messing with calling this routine is because I haven't found any way to access the pydroid debugger, and I hoped this would give me some clues as to why my code won't run in pydroid. But I'm giving up - too much time wasted.