RPA.Windows how to register a new keyword in module actions.py

I tried to sole my problem with the “Collapse Pattern” as sugested with a modification of the module actions.py. I defined a keyword “get_collapse_state” but In a test before trying to implement the code I tested if my new keyword will be used an observed that I got an error the “get_collapse_state” is no valid methode:

PS D:\PYTHON> d:; cd ‘d:\PYTHON’; & ‘c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\python.exe’ ‘c:\Users\Herbe.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\adapter/…/…\debugpy\launcher’ ‘63105’ ‘–’ ‘D:\PYTHON\tools\KeePassV91.py’
CollapseState.zip (1.7 KB)
CollapseState.zip (1.7 KB)

Traceback (most recent call last):
File “D:\PYTHON\tools\KeePassV91.py”, line 82, in
val = lib.get_collapse_state(elem1)
File “c:\ProgramData\robocorp\ht\51386a9_b1f3c24_791b5f1e\lib\site-packages\robotlibcore.py”, line 103, in getattr
raise AttributeError(“{!r} object has no attribute {!r}”.format(type(self).name, name))
AttributeError: ‘Windows’ object has no attribute ‘get_collapse_state’

It looks like you try to use get_collapse_state but Windows lib does not have this available. if you want to expand library you should look into extending existing libraries Robot Framework User Guide

1 Like

I found another solution for my problem. Modifying the standard keywords is not a good solution as mentioned in the User Guide.
Thank you for your help