In computer programming, when a program analyzes itself, we call it "reflection" or "introspection". Example: A program has several features. When the program runs, it can analyze itself to determine what features it supports and present it in the user interface. The user could choose one of the features and instruct the program to run it.
Now, the question: Is there an equivalent mechanism in the brain? I.e. how can the brain think/reflect about a behavior/capability without executing the behavior/capability? Is there a special "module" in the brain that is responsible for reflection and one responsible for execution? If yes, how does the brain decide which module to use in the specific context (thinking vs. acting)?