import subprocess
from pathlib import Path
import sys
import os

output_folder_name = "/out_search"

droppedFile = sys.argv[1]
droppedName = Path(droppedFile).name

#get path of script location and remove the tail
head_tail = os.path.split(sys.argv[0])
output_path = head_tail[0]
del sys.argv[0]

#check if output folder exists, otherwise create it
isExist = os.path.exists(output_path+output_folder_name)
if not isExist:
    os.makedirs(output_path+output_folder_name)

for each in sys.argv:
    print(each)
    print(droppedFile)
    print(droppedName)
    args = 'py -3 -m getnative --show-plot-gui -dir "{output_path}/out_search" "{each}" '.format(output_path=output_path, each=each)
    print(args)
    #print(each)
    run = subprocess.Popen(args)
    
    

k=input("press close to exit") 
