我有一个主文件,可以说main.py
我在哪里生成对象(实体)列表:
bodies = [body.Body(
number = i,
length = 1.,
mass = 10.,
mass_moment_of_inertia = 1.,
theta = 0.,
omega = 0.,
xy_force_vector = np.array([0., 0.]),
xy_u_F_vector = np.array([0., 0.]),
ground = 0,
limit_x = 0.,
limit_y = 0.,
z_moment = 0.,
stiffness_coef = 0.,
damping_coef = 0.)
for i in range(0, N)]
我想使用(多个)子文件/模块中的对象(主体)列表的属性来计算所需的值。我有模块 submodule.py 有: submodule.py
def fun_name():
for i in range(0, N):
# joins mass of all objects in one array (this is just an example, I have to to more calculations with the object properties)
q = bodies[i].mass.append()
return q