I have found myself using a lot of global variables in order to access user input (e.g. a file path) but I know this is bad practice and will likely lead to spaghetti code in the end.
How can I better organise this application without global variables so that I can make use of variables that are set within the GUI through button presses etc?
I've tried global variables, which do work, but will probably lead to bad habits forming, without these I get errors regarding variables being out of scope and undefined.
The application works so far when everything is within one .py file but now that it is growing and I want to split it up into a proper structure I am struggling.
I want to be able to use variables from within a method tied to my GUI so that I can split the application up into multiple files rather than having it all within one file which doesn't seem practical or good practice. I'm not sure if it would be better to use classes instead or if there is a better approach for what I am trying to achieve.