# Adding value sets dynamically

**URL:** <https://forum.robotframework.org/t/adding-value-sets-dynamically/7791>\
**Category:** Pabot\
**Created:** [10 September 2024 07:31 UTC](https://forum.robotframework.org/t/adding-value-sets-dynamically/7791 "2024-09-10T07:31:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vahv1](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/vahv1/32/3923_2.png) [@Vahv1](https://forum.robotframework.org/u/Vahv1)\
**Post date:** [10 September 2024 07:31 UTC](https://forum.robotframework.org/t/adding-value-sets-dynamically/7791/1 "2024-09-10T07:31:38Z")

</div>

I am trying to dynamically create a valueset in the suite setup according to an example I found here: [New keyword: "Add Value To Set" · nestoracunablanco/pabot@ea50f30 · GitHub](https://github.com/nestoracunablanco/pabot/commit/ea50f3038c5be14a66f95c66ab38be523c1e05f0)

```python
from pabot import pabotlib
...
@library(scope='GLOBAL', version='1.0')
class MyLib(DynamicCore):
...
    def start_suite(self, data, result):
        """
        Robot listener called when a test suite starts.
        """
        lib = pabotlib.PabotLib()
        my_value_set_1 = {"key": "someVal1", "tags": "valueset1,common"}
        my_value_set_2 = {"key": "someVal2", "tags": "valueset2,common"}
        lib.add_value_to_set("MyValueSet1", my_value_set_1)
        lib.add_value_to_set("MyValueSet2", my_value_set_2)
        log(f"{lib._values=}")
        lib.acquire_value_set("common")
...

```

And then running my test set with

```python
pabot --pabotlib --processes 2 --variablefile myvars.py tests/suite1 tests/suite2

```

But this results in an error: _Value set cannot be aquired. It was never imported or all are disabled. Use --resourcefile option to import._

The log line correctly logs the new value sets. But if I add this log line in \_PabotLib, then I get an empty dict.

```python
class _PabotLib(object):
...
    def acquire_value_set(self, caller_id, *tags):
        log(f"In _PabotLib {self._values=}")
        ...

```

What am I doing wrong? Why is the `self._values` not correctly updated when `acquire_value_set` in `_PabotLib` uses it?
