Can you try this approach?
I tried with:
Python 3.12.4 installed at C:\Program Files\Python312
Studio 23.10.7
UiPath.Python.Activities.1.8.1
UiPath.System.Activities.23.10.6
Python code:
import sys
import os
sys.path.append(os.path.dirname(os.path.realpath('C:\\Program Files\\Python312')))
def simple_function():
import json
result = {"message": "Test"}
json_output = json.dumps(result)
return json_output
A similar approach was discussed here Integrating Python script for Encrypt and Decrypt