>>> def create_function(code):
... exec(code)
...
>>>
>>>
>>> def main():
... code = "def a(stri):\n\tprint(stri)"
... create_function(code)
... a("Hello World")
...
>>> main()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in main
NameError: name 'a' is not defined
>>>
I want to do this for Discord.py Embeds, Is there way to define function with exec command in another function ?