in a ddp, the model is stored in ddp.module here  10.
so far, i use ddp_model.module.attribute .

That seems correct since you are accessing a python object attribute.

is it safe to use the same trick for dataparallel 1 ?

Yes, it should be safe since you are accessing the attributes of a python object.