# Returning values from custom library

**URL:** <https://forum.robotframework.org/t/returning-values-from-custom-library/4709>\
**Category:** Robot Framework\
**Created:** [15 September 2022 09:53 UTC](https://forum.robotframework.org/t/returning-values-from-custom-library/4709 "2022-09-15T09:53:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielAlonso](https://avatars.discourse-cdn.com/v4/letter/d/8491ac/32.png) [@DanielAlonso](https://forum.robotframework.org/u/DanielAlonso)\
**Post date:** [15 September 2022 09:53 UTC](https://forum.robotframework.org/t/returning-values-from-custom-library/4709/1 "2022-09-15T09:53:16Z")

</div>

Hi all! I started to use Robot one week ago and I am trying to store a value in the test cases file which is generated in a library written in Python but I am not able to do it.  
The library has a class with the same name of the library. I want to store the value in ${x} variable. My code is the following:

\*\*\* Test Cases \*\*\*  
Sum something  
${x}= Make a sum  
Log ${x}  
\*\*\* Keywords \*\*\*  
Make a sum  
[Documentation] This performs a sum  
calculator.mysum ${number}

calculator.mysum is the function from the library and just prints the number which has “2” by default. The ${x} variable gives me ‘None’ when the code is executed and I expect ‘2’.

Thanks in advance!

---

<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:** [15 September 2022 12:23 UTC](https://forum.robotframework.org/t/returning-values-from-custom-library/4709/2 "2022-09-15T12:23:04Z")

</div>

> [@DanielAlonso](#):
>
> and just prints the number which has “2”

The printing goes to the log files (or screen).

In you keyword you should assign the result of the library keyword and then return:

```robot
***Test Cases***
Sum something
    ${x}= Make a sum
    Log ${x}

***Keywords***
Make a sum
    [Documentation] This performs a sum
    [Arguments] ${number}=${None}
    ${value}= calculator.mysum ${number}
    RETURN ${value}

```
