charlottebakalar
I think the easiest way would be to use iolite's command line features to run a refactored version of your python script from an external script. The external script (whether written in python itself, powershell, bash, ...) would iterate through the files in your folder and call iolite with command line arguments that'll load the data and run your python script. Something like (with a lot of the details missing):
import subprocess
script = '''
data.importData(r'$file')
# Do all your stuff to adjust selections...
data.saveSession(file_name_and_path)
'''
files = [...]
iolite=r'C:\Program Files (x86)\iolite-software\iolite4\iolite4.exe'
env = {
'PATH': 'C:\\Program Files (x86)\\iolite-software\\iolite4\\',
'PYTHONPATH': 'C:\\Program Files (x86)\\iolite-software\\iolite4\\python38.zip',
'SYSTEMROOT': 'C:\\Windows'
}
for file in files:
script_for_file = script.replace('$file', file)
print(subprocess.run([iolite, '-p', script_for_file], env=env, capture_output=True))
I've used something like this in the past and it should get the job done.
All the best,