# Best way to pass multiple parameter to methods in robot framework

**URL:** <https://forum.robotframework.org/t/best-way-to-pass-multiple-parameter-to-methods-in-robot-framework/5157>\
**Category:** Robot Framework\
**Created:** [10 January 2023 09:59 UTC](https://forum.robotframework.org/t/best-way-to-pass-multiple-parameter-to-methods-in-robot-framework/5157 "2023-01-10T09:59:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bk-user](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bk-user/32/1446_2.png) [@bk-user](https://forum.robotframework.org/u/bk-user)\
**Post date:** [10 January 2023 09:59 UTC](https://forum.robotframework.org/t/best-way-to-pass-multiple-parameter-to-methods-in-robot-framework/5157/1 "2023-01-10T09:59:20Z")

</div>

Hi

I have one common method in my robot script  
Get Source and Send to DB  
[Arguments] ${api\_url} ${id} ${page\_name1} ${page\_name2} ${page\_name4} ${page\_name5} ${page\_name6} ${page\_name7} ${page\_name8} ${page\_name9}

Whenever I have call common method

```
Get Source and Send to DB 1 2 3 4 5 6 7 8 9

```

I have to pass all these parameter all the time. Is there any best way to pass that in single object and refer  
I want to understand all the best approaches

---

<div class="post-metadata">

**Author:** ![SimoneTrinh](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/simonetrinh/32/2213_2.png) [@SimoneTrinh](https://forum.robotframework.org/u/SimoneTrinh)\
**Post date:** [10 January 2023 10:22 UTC](https://forum.robotframework.org/t/best-way-to-pass-multiple-parameter-to-methods-in-robot-framework/5157/3 "2023-01-10T10:22:24Z")

</div>

Hello,

You can use this magic trick : ).

```python
    Run Magic Keyword
        [Arguments] ${KW} @{KWARGS}
        (Do Something)

```

EX Use:

```python
Run Magic Keyword 1 2 3 4 5 6 7 8 9

```

=\> Use this way, you can pass as many as you want args to this keyword.

Cheers,

---

<div class="post-metadata">

**Author:** ![bk-user](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bk-user/32/1446_2.png) [@bk-user](https://forum.robotframework.org/u/bk-user)\
**Post date:** [10 January 2023 10:34 UTC](https://forum.robotframework.org/t/best-way-to-pass-multiple-parameter-to-methods-in-robot-framework/5157/4 "2023-01-10T10:34:01Z")

</div>

@SimoneTrinh

How to read values from @{KWARGS} and ${KW} inside that method

I want to log values

What is first parameter ${KW} …how many values we can pass and fetch  
what is second parameter @{KWARGS}…how many values we can pass in that and how to fetch

I have used like below  
Run Magic Keyword  
[Arguments] ${KW} @{KWARGS}  
Log ${KW}  
Log ${KWARGS}  
Log @{KWARGS}  
:FOR ${arg} IN @{kwargs}  
${key} ${value}= Evaluate “${arg}”.split(“=”)  
Log ${key}, ${value}

I am getting undefined keyword FOR

I also tried above code -Getting error saying unexpected arguments

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

---

<div class="post-metadata">

**Author:** ![bk-user](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bk-user/32/1446_2.png) [@bk-user](https://forum.robotframework.org/u/bk-user)\
**Post date:** [10 January 2023 11:39 UTC](https://forum.robotframework.org/t/best-way-to-pass-multiple-parameter-to-methods-in-robot-framework/5157/5 "2023-01-10T11:39:16Z")

</div>

@SimoneTrinh

Below is code-

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