I tried making a script that reads an array of scripts directories in it, and launches them asynchronously. The problem in my script is that it launches only the last script in the array.
import json
import asyncio
import firstscript
import secondscript
def main():
list = json.load(open('list.json'))
launch_list = []
for i in range(len(exchanges_list['e'])):
get_exchange = exchanges_list['e'][i][0]
launch_exchange = str(get_exchange.lower() + '.' + get_exchange.lower() + '()')
launch_list.append(launch_exchange)
async def handle_script(uri):
exec(uri)
async def handler():
await asyncio.wait([handle_socket(uri) for uri in launch_list])
asyncio.run(handler())
if __name__ == "__main__":
main()