# Calling an instance from a class doesn't work although calling a method works

**URL:** <https://forum.robotframework.org/t/calling-an-instance-from-a-class-doesnt-work-although-calling-a-method-works/5661>\
**Category:** Robot Framework\
**Created:** [7 May 2023 10:34 UTC](https://forum.robotframework.org/t/calling-an-instance-from-a-class-doesnt-work-although-calling-a-method-works/5661 "2023-05-07T10:34:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rana](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@Rana](https://forum.robotframework.org/u/Rana)\
**Post date:** [7 May 2023 10:34 UTC](https://forum.robotframework.org/t/calling-an-instance-from-a-class-doesnt-work-although-calling-a-method-works/5661/1 "2023-05-07T10:34:56Z")

</div>

I’m using a customized robot decorator to create test suite, test case and robot keyboard to run the test cases using Python.  
When “LibAction1” is called as a method, the report passed

While creating an instance from a dummy class and calling the “LibAction1” as an instance method doesn’t work, throwing an exception “No keyword with name ‘LibAction1’ found”

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/a/a384ed987973edee5eb40413aa2355d544bb0a62.png)

Could you please advise why does robot report throw and exception when using an instance method although the keyword annotation is added to this method.  
For your reference the [working](https://drive.google.com/file/d/1SEJy7-q2z5oQbWbl4Rp3XnJvx0M6JvH1/view?usp=share_link) and the [not working](https://drive.google.com/file/d/1UfGMEM_wZXHPchvIVDcyhlGubz1u9gel/view?usp=share_link) projects are uploaded on the Drive.

---

<div class="post-metadata">

**Author:** ![pekkaklarck](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/pekkaklarck/32/1019_2.png) [@pekkaklarck](https://forum.robotframework.org/u/pekkaklarck)\
**Post date:** [8 May 2023 12:11 UTC](https://forum.robotframework.org/t/calling-an-instance-from-a-class-doesnt-work-although-calling-a-method-works/5661/2 "2023-05-08T12:11:55Z")

</div>

You try to take the library into use like `dummy_tests.py`, right? In that case that _module_ becomes a library, not the class. Only if the module name and the class name match, Robot will use the class as a library. Alternatively you could make sure `dummy_tests` is in PYTHONPATH and then import the library like `dummy_tests.DummyTestLib`, but the former solution is typically easier. For more details see the [User Guide](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#specifying-library-to-import).

---

<div class="post-metadata">

**Author:** ![Rana](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@Rana](https://forum.robotframework.org/u/Rana)\
**Post date:** [9 May 2023 09:10 UTC](https://forum.robotframework.org/t/calling-an-instance-from-a-class-doesnt-work-although-calling-a-method-works/5661/3 "2023-05-09T09:10:57Z")

</div>

Thank you for your reply, the issue has been solved but another issue appears.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/3/35cceb333c6c96caeb11c594d67d0d6fae467bfa.png)  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/9/93cdea8c5e42e373e36f8d5e6cfb3b47ba004f6e.png)  
Throwing “_TypeError: dummy\_tests.LibAction1() takes 1 positional argument but 2 were given_”, although no arguments are given to the method
