Is there any package in python that can read a python script and give the ability to modify it? Something like the following:
my_script: PythonScript = read_script("my_script.py")
list_of_functions: [PythonFunction] = my_script.functions
for func in list_of_functions:
print(func.name)
print(func.body)
list_of_functions[0].name = "new_function_name"
my_script.functions = list_of_functions
So again what I am looking for is a package that can read a python script and give the ability to modify it, not necessary the same way I did in my example, I just have a lot of scripts and I am looking for a way to do a fix on all of them without using find and replace in an IDE nor reading them as text files for example. Somehow traversing a python script from python code? I do not know what keywords should I use to do a proper search either.