Well, I have pretty hard task and I'm completely stucked, like in any direction.
What program should do:
- Import all modules (names are random) from folder
MainScript.py modules/ mod1.py mod2.py mod3.py ...
- Execute specific (known name, and everywhere it's same) function.
mod1.main()
mod2.main()
mod3.main() ...
As I understand it, I should list all files in folder , then make list with them and for each [x] in list import module and execute script. I've found that modules[0].main()
works only if modules[0]
no string, so, it should be modules[0]=main
not modules[0]='main'
. So and there I need somehow deal with it... but for import
I don't know...
I've already googled about it, only found https://stackoverflow.com/a/1057534/10289135 And I guess it will not work for me (I also don't understand how it works and script didn't work for me)
Any ideas?