# Dynamic libraries and PythonLibCore

**URL:** <https://forum.robotframework.org/t/dynamic-libraries-and-pythonlibcore/7410>\
**Category:** Development\
**Created:** [11 June 2024 15:40 UTC](https://forum.robotframework.org/t/dynamic-libraries-and-pythonlibcore/7410 "2024-06-11T15:40:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasle](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/jasle/32/3965_2.png) [@jasle](https://forum.robotframework.org/u/jasle)\
**Post date:** [11 June 2024 15:40 UTC](https://forum.robotframework.org/t/dynamic-libraries-and-pythonlibcore/7410/1 "2024-06-11T15:40:59Z")

</div>

Hello,  
I try to use [PythonLibCore](https://github.com/robotframework/PythonLibCore) together with the [Robot Framework dynamic library API](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#dynamic-library-api), but the so build library does not return any keywords.

Did anyone used PythonLibCore together with the dynamic library api or know how to use it?

Here is an short example (does not contains required imports):  
dynamic\_lib.py

```python
from robot.api.deco import library
from robotlibcore import DynamicCore

from DynamicLib.lib_a import LibA

@library
class DynamicLib(DynamicCore):

    def __init__ (self):
        DynamicCore. __init__ (self, [LibA()])

```

lib\_a.py

```python
from typing import Any, List, Dict

from robot.api.deco import library
from robot.api.interfaces import DynamicLibrary

@library
class LibA(DynamicLibrary): # DynamicLibrary: abstract baseclass for interface

    def get_keyword_names(self) -> List[str]:
        return ['A Keyword 1', 'A Keyword 2']

    def run_keyword(self, name: str, args: List[Any], named: Dict[str, Any]) -> Any:
        pass

```

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [11 June 2024 16:23 UTC](https://forum.robotframework.org/t/dynamic-libraries-and-pythonlibcore/7410/4 "2024-06-11T16:23:44Z")

</div>

Please detail your problem.

---

<div class="post-metadata">

**Author:** ![jasle](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/jasle/32/3965_2.png) [@jasle](https://forum.robotframework.org/u/jasle)\
**Post date:** [11 June 2024 23:14 UTC](https://forum.robotframework.org/t/dynamic-libraries-and-pythonlibcore/7410/5 "2024-06-11T23:14:18Z")

</div>

Hello,  
updated the initial post to what it should have been. Hope the issue is clear now.

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [12 June 2024 07:41 UTC](https://forum.robotframework.org/t/dynamic-libraries-and-pythonlibcore/7410/6 "2024-06-12T07:41:36Z")

</div>

If i understand what you are trying to accomplish, your LibA class should inherit LibraryComponent and not DynamicLibrary.

Second, you should be using @keyword decorator in LibA and thus, list of keywords should be automatically available so there’s no need for get\_keyword\_names().

And finally, run\_keyword() shouldn’t be necessary either.

_BUT_ take this all with a grain of salt …

---

<div class="post-metadata">

**Author:** ![jasle](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/jasle/32/3965_2.png) [@jasle](https://forum.robotframework.org/u/jasle)\
**Post date:** [12 June 2024 09:41 UTC](https://forum.robotframework.org/t/dynamic-libraries-and-pythonlibcore/7410/7 "2024-06-12T09:41:52Z")

</div>

I updated the initial post with the imports, so the example should be more clear.

@rasjani:  
`DynamicLibrary` is an abstract baseclass for implementing the dynamic library interface and there is no `LibraryComponent` in PythonLibCore.

I am implementing a [dynamic library](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#dynamic-library-api), not a static library, so there are no methods as keywords and I need to implement `get_keyword_names()` and `run_keyword()`.
