# add_shared_dict_value

**Descripción**

Añade un valor a una clave del diccionario interno compartido. Esta función es utilizada por todos los procesos paralelos.

**Parámetros**

<table border="1" id="bkmrk-module-acepta-el-tip" style="width: 562px; height: 87px;"><tbody><tr style="height: 29px;"><td style="width: 70px; height: 29px;">**Nombre**</td><td style="width: 54px; height: 29px;">**Tipo**</td><td style="width: 90px; height: 29px;">**Requerido**</td><td style="width: 348px; height: 29px;">**Descripción**</td></tr><tr style="height: 29px;"><td style="width: 70px; height: 29px;">key</td><td style="width: 54px; height: 29px;">str</td><td style="width: 90px; height: 29px;">Si</td><td style="width: 348px; height: 29px;">La clave en el diccionario compartido</td></tr><tr style="height: 29px;"><td style="width: 70px; height: 29px;">value</td><td style="width: 54px; height: 29px;">None</td><td style="width: 90px; height: 29px;">SI</td><td style="width: 348px; height: 29px;">El valor a añadir a la clave</td></tr></tbody></table>

<div id="bkmrk-"></div>**Return**

<div id="bkmrk-tipo-none"><table border="1" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 100%;">**Tipo**</td></tr><tr><td style="width: 100%;">None</td></tr></tbody></table>

</div>**Versión**

- 1.0.0

**Ejemplo**

```
import pandoraPlugintools as pt

# Define a function to be executed by parallel processes
def process_data(item):
    # Process the data and add a value to the shared dictionary
    result = item * 2
    pt.add_shared_dict_value(key=str(item), value=result)

# List of items to process
data_list = [1, 2, 3, 4, 5]

# Create a shared dictionary and lock for synchronization
shared_dict = multiprocessing.Manager().dict()
shared_dict_lock = multiprocessing.Manager().Lock()

# Set the shared dictionary and lock in the module
pt._SHARED_DICT = shared_dict
pt._SHARED_DICT_LOCK = shared_dict_lock

# Number of parallel processes to use
num_processes = 2

# Run the function for each item using parallel processes
success = pt.run_parallel(num_processes=num_processes, function=process_data, data_list=data_list, print_errors=True)

if success:
    print("All processes executed successfully.")
else:
    print("Errors occurred during process execution.")
In this example, the process_data function processes each item and adds a value to the shared dictionary using the add_shared_dict_value function. The run_parallel function is used to execute the process_data function in parallel processes for the given list of items. The shared dictionary and lock are created using the multiprocessing.Manager() and then assigned to the corresponding module variables _SHARED_DICT and _SHARED_DICT_LOCK in the pandoraPluginTools module.






```