I have a script/module (call it "main") that calls another script/module (call it "other"). I use
"main" (business end only):
-m
EDIT:
It turns out, calling
runpy.run_path() to execute the call. All's good, except "other" is supposed write to a variable in "main" but "other" takes a few seconds to run. "main" has already executed it's lines by the time "other" is done. So, how do I force "main" to wait until "other" is finished executing and sending over the info to populate the variable in "main"? I know of timer.sleep(), which is fine by me, but I can't figure out how to wait the right amount of time for "other" to finish execution. Here's the code-"main" (business end only):
mem_dumps = []
runpy.run_path('delete_dump.py')
time.sleep(4)
print(mem_dumps)
sys.exit()"other":import os, ctypes, sys, practice_gui
def scan_dumps():
dumps = []
for dpath, dname, fname in os.walk('C:\\'):
for fn in fname:
if fn.endswith('.dmp'):
dumps.append(os.path.join(dpath, fn))
return dumps
if ctypes.windll.shell32.IsUserAnAdmin():
practice_gui.mem_dumps = scan_dumps()
else:
ctypes.windll.shell32.ShellExecuteW(None, 'runas', sys.executable, 'delete_dump.py', None, 1)"other' actually runs twice--once to restart as admin and once as admin. I need to send scan_dumps return to mem_dumps in "main". I think I'm solid, I just don't know how to determine the right amount of time to wait.-m
EDIT:
It turns out, calling
time.sleep() puts "other" to sleep too. How can I work around that?
