On `JuMP`

, I have a model

```
m = Model()
@variable(m, x[1:2])
```

By passing `m`

to a function, can I obtain the variable `x`

to define a new model with `x`

?

On `JuMP`

, I have a model

```
m = Model()
@variable(m, x[1:2])
```

By passing `m`

to a function, can I obtain the variable `x`

to define a new model with `x`

?

[JuMP] Creating a Nonlinear Least Squares model

can I obtain the variable x

Yes `m[:x]`

.

to define a new model with x?

No. `x`

belongs to the model `m`

.

Do you want to make a variable with the same name? Or bounds? Or indices? If so, just pass the necessary data to build the variable rather than the model and actual variable.

Thanks @odow, but I must clarify. I donâ€™t know which variables the model has, that is, instead of defining `x`

, an user could define only `y`

.

This is related to another problem and the context is clearer there.