How to get code flow?

I understand there are (Python ?) tools to help me to determine the application code flow. Perhaps the tool is called "code hierarchy " ?
I am “reverse engineering” a Python code and it got me stooped because there are two “” (modules?) .
The “first one” gets executed when I run the code in debug , It basically checks a variety of “versions” of some , so far unknown, supporting code.
I am planing to “reshuffle” the main window to include “QMDIArea” menu and it would help me to know where is the "main window " actually implemented. ( It builds about 15 “subwindows” and it really clutters the application)

Yes, I have been stepping thru the code but it would probably make it easier to know the flow.


1 Like

It sounds like you might be looking for a call graph?

(There are also control flow graphs, but those are more formal and more detailed and would probably not help much for the “big picture” kind of question you have. They are better for analyzing particular functions/subsets of functions IMO.)

I haven’t used these kinds of tools with Python specifically, but a quick search for “Python control flow graph” has some promising looking tools, also the Call graph wiki page has a list for Python. code2flow looks like it might be nice?

Also, if you haven’t already, I would get the source code into a tool or structure you can search for strings. (VS Code is nice for this, as are unix CLI tools like grep.) If the application emits logs when loading the main window or has any obvious string constants displayed in the main window, I would search for those. Log strings in particular can sometimes lead you to an exact line in a file.

Thanks again, appreciate your support.
I did manged to get into “hierarchy” and it is helping.
I need to get a book to learn some about Python terminology. This code is really nasty with stuff like
"_Version " or “version” or “Version(…)” or “” - and of course no comments which is what and for what purpose…
I just made another post to that effect , but not sure if I did posted the file…