agentscope
agentscope copied to clipboard
[Feature]: execute python code in thread
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)