I am currently trying to simulate a population of cells in two different language, NEURON and NEST. The thing is that I want to have a simulation that is running for a rather large period of time, where I can control every input that happens every millisecond. As the input for the NEURON cells comes from the NEST part of the program, it is mandatory to be able to control each step.

for each step in total_time
h.tstop = dt
stimulate in NEST
stimulate in NEURON
h.run()

here it is not possible to keep the values of the last step for the new one, and also I have only a sequence of really short steps...
I've gone through the py_doc but I didn't really understand what I should use in order to achieve what I want to do...

When using fixed-step integration, the time step size is controllable by setting h.dt; by default it is 1/40 ms.

When controlling a simulation in this way, before beginning your advances, you must explicitly initialize the simulation with e.g. h.finitialize(-65) (where -65 can be replaced with whatever initial membrane potential).

You may also be interested in h.continuerun(tstop) which advances the simulation until time tstop, however many internal time steps that takes. Again, using this requires explicitly initializing the simulation at the beginning as it preserves state unlike h.run which implicitly reinitializes every time it is called. Also note that like h.run, h.continuerun is only available after loading the standard run system. This can be done in many ways, e.g. by importing gui, or by h.load_file('stdrun.hoc')