# Passing session attributes to a method

**URL:** <https://community.gatling.io/t/passing-session-attributes-to-a-method/4176>\
**Category:** Gatling (Open-Source)\
**Created:** [February 14, 2018, 12:54pm UTC](https://community.gatling.io/t/passing-session-attributes-to-a-method/4176 "2018-02-14T12:54:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arun](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Arun](https://community.gatling.io/u/Arun)\
**Post date:** [February 14, 2018, 12:54pm UTC](https://community.gatling.io/t/passing-session-attributes-to-a-method/4176/1 "2018-02-14T12:54:22Z")

</div>

I am using Gatling for generating load. Here, I have a situation where I need to call a method present in an another object. The parameters to this method are values from feed file.However, from results i can see that there are no call to method.  
Apologies if it is a naive question. I am new to Gatling and Scala.

`  
//Method call from simulation class

val scnTrial= scenario(“trial”)

.feed(tsv(“V1.txt”).circular)  
.exec(session =\> {  
ObjectA.methodA(session(“UserID”).as[String],session(“key1”).as[String],session(“key2”).as[String])  
session  
})  
.inject(rampUsers(1) over (1))

`

`

```auto
//Method definition

ObjectA{

def methodA(vUserID:String,vkey1:String,vkey2:String)={    
  exec(session=>{
  session.set("UserID",vUserID).set("key1",vkey1).set("key2",vkey2)
})
  .exec(http("Authenticate")
    .post("/abc/def")
    .header("Content-Type", "application/json")
    .body(StringBody("{\"uid\": \"${UserID}\", \"key1\": \"${key1}\",\"key2\":\"${key2}\"}"))    
}

}

```

`

-Arun
