I ran into some trouble with modules lately. I'm having a hard timefiguring out how I can get the file that has imported the module. basically:
import sys
imported = sys.get_modules_that_have_imported_this_script()
#and then the rest of the code
to be more specific. modules run when you import them right? so is there a way to get what program the module is running from? (preferably the path or file name)
edit: i want the file name so I can use the inspect module to get source code
edit2: I don't want to get the source of the module. I want to find the main program from a module imported within it
edit3: maybe this will help https://pasteboard.co/OMO6tQoTKALI.png