I'm not entirely sure why you would want to know this.
Any method is inherently flawed because it won't affect the executable (part of the .exe) side of things, and the executable will also call out to several modules.
Generally speaking, an error is tracked from the moment it occurs all the way to the top most place of invocation, in all cases this ends at the executable, in the end it always does.
But, all the modules that are loaded can be found in the modules dictionary in the sys module.