I was Trying to Make an python line as String and run it using exec(), that string was supposed to invoke a module and pass parameters ,here the parameter is a list and when i inject in string and call exec on it .. i'm getting - TypeError: can only concatenate str (not "list") to str
my code :
def skill_manager(skill_name,parameter_list):
skill_name = skill_name[0]
print(parameter_list)
importline = "import skill."+skill_name+" as skill"
exec(importline)
if not skill_name == None:
runline = "skill." + skill_name + "(" +"'"+ parameter_list + "'" + ")"
print(runline)
exec(runline)
error :
..... line 40, in skill_manager
runline = "skill." + skill_name + "(" +"'"+ parameter_list + "'" + ")"
TypeError: can only concatenate str (not "list") to str
i tried converting list into string and otherside of code back to list .. but it has to be done in all skills ..
i somehow need to pass list from the skill_manager()