Sorry if this question is incredibly easy to answer, or I sound like an idiot. I'm wondering how I would execute a script in one file, pygame event loop, blits, etc, then switch to another file, SelectWorld.py, which has it's own event loop, and blits, and etc. If I just call it's main function, does it create any slowdown because I still have the original file open, or am I fine just doing that? SelectWorld.transition() sort of thing. Thanks in advance.
Here, what is wanted is to be able to share the variables between two different applications: 2 different scripts with event loops, blits, etc. So by definition, they should be on different process (if they must be running at the same time).
There is two major ways of doing this:
1 - Client-Server Architecture (like a Game server would be) (the server and client can both run on the same machine)
2 - Multiprocessing with 2 process running on the same machine with different ways of communicating and synchronize the variables. (Pipe Queue, Event, etc)
I understand that you're trying to do a kind of variables profiling of your game? If it is used to debug your game or test it. I consider that you need a lot of code to gain a little useful information (because the game might run too fast for you to analyse the variables)
You have those alternatives:
1 - import pdb, pdb.set_trace(): it will stop the process at the line where you called the function and, on the terminal, you can see the variables values.
2 - You can use Eclipse (with pyDev): Very good debugger (line by line)
3 - Unittest, Mock: Is something you should start to use, because it is useful, because you can easily see when you break some old code (with unittest) and/or testing new code...
I hope it helps you :)
Python/Pygame transitioning from one file to another