Info: I am using OpenAI Gym to create RL environments but need multiple copies of an environment for something I am doing. I do not want to do anything like [gym.make(...) for i in range(2)]
to make a new environment.
Question: Given one gym env what is the best way to make a copy of it so that you have 2 duplicate but disconnected envs?
Here is an example:
import gym
env = gym.make("CartPole-v0")
new_env = # NEED COPY OF ENV HERE
env.reset() # Should not alter new_env
Astariul has an updated answer::
Their answer states:
import copy
env_2 = copy.deepcopy(env)
For more info about 'copy.deepcopy', and the copy library