modelscope / agentscope

Start building LLM-empowered multi-agent applications in an easier way.

Home Page:https://modelscope.github.io/agentscope/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature]: execute python code in thread

rayrayraykk opened this issue · comments

The current implementation of exec_python_code is a multi-processing version, which should be in if __name__ == "__main__". We can implement it in the thread and mark it as TODO now.

Update about global var:

# Create a new global namespace dictionary
 global_namespace = {}

 # Copy the contents of the current global namespace into the new namespace dictionary
 global_namespace.update(globals())

 # Execute the provided code within the newly defined global context
 exec(code, global_namespace)