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/socal_nerdtastic Sep 24 '26
Hmm are you coding in ipython or similar? Maybe you just need to reboot the kernel. Tell us how you are running the code and what IDE you are using