# Is it possible to modify the actor's init value?

**URL:** <https://discuss.ray.io/t/is-it-possible-to-modify-the-actors-init-value/4656>\
**Category:** Ray Core\
**Created:** [January 11, 2022, 1:56pm UTC](https://discuss.ray.io/t/is-it-possible-to-modify-the-actors-init-value/4656 "2022-01-11T13:56:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mincheolseong](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/mincheolseong/32/1964_2.png) [@mincheolseong](https://discuss.ray.io/u/mincheolseong)\
**Post date:** [January 11, 2022, 1:56pm UTC](https://discuss.ray.io/t/is-it-possible-to-modify-the-actors-init-value/4656/1 "2022-01-11T13:56:40Z")

</div>

I wonder if it is possible to change the init value of Environment class declared as actor in MainEnvironment.py in main.py.  
What I want is to modify the code in main.py to change self.num\_steps in Trainer.py.

```auto
#Trainer.py
class TrainerParams:
    def __init__ (self):
        self.num_steps = 1e5

class Trainer:
    def __init__ (self, params: TrainerParams):
        self.params = params

```

```auto
#MainEnvironment.py
from Environment import BaseEnvironment, BaseEnvironmentParams
from Trainer import TrainerParams, Trainer

class EnvironmentParams(BaseEnvironmentParams):
    def __init__ (self):
        super(). __init__ ()
        self.trainer_params = TrainerParams()

@ray.remote
class Environment(BaseEnvironment):
    def __init__ (self, params: EnvironmentParams):
        super(). __init__ (params)
        self.trainer = Trainer(params.trainer_params)

```

### If I can not consider ray, the code can be written as below.

```auto
#main.py
from MainEnvironment import Environment

env = Environment(params)
env.trainer.params.num_steps *= 0.4

```

### But I have to consider ray.

```auto
#main.py
import ray
from MainEnvironment import Environment

ray.init()
env = [Environment.remote(params) for i in range(2)]
ray.actor.exit_actor()
for i in range(2):
    env[i].trainer.params.num_steps *= 0.4

```

I guess I need to access the init value after terminating `ray.init().`  
But it doesn’t work. I also suspect that accessing the actor without `.remote()` is one cause of the error, but I can’t find a solution.

---

<div class="post-metadata">

**Author:** ![mincheolseong](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/mincheolseong/32/1964_2.png) [@mincheolseong](https://discuss.ray.io/u/mincheolseong)\
**Post date:** [January 12, 2022, 10:12am UTC](https://discuss.ray.io/t/is-it-possible-to-modify-the-actors-init-value/4656/2 "2022-01-12T10:12:33Z")

</div>

I solve my problem thanks to " Passing Around Actor Handles" in the ray official website.
