I want to separate the classes and functions which ara in a single .py script into different .py scripts to be tidy. for example, my_functions.py and my_class.py. but some functions contain “my_class.py” ‘s class parameters or attributes. for example:
def tlbo_dm_continuous(pop, itr):
if group_number == 0:
variable = len(frame_veri)
else:
variable = group_number
"""sınıf oluştur"""
X = np.array([lower + np.random.random(variable) * (upper - lower) for i in range(pop)])
F = np.array([]) #cezalandırılmış amaç fonksiyonu
Psi = np.array([]) #ceza katsayısı
for s in range(pop):
Bar2D.reset()
for j in bar: # çubuk eleman verilerinin örneklenmesi
if group_number == 0:
bar[j].area = X[s][j - 1]
else:
bar[j].area = X[s][bar[j].group - 1]
Bar2D.Sys_sol()
psi = (1 + Bar2D.fi + Joint2D.fi) ** 2
F = np.append(F, (psi * Bar2D.W))
Psi = np.append(Psi, psi)
“tlbo_dm_continuous” function contains “Bar2D.Sys_sol()” class attribute.
when i import “tlbo_dm_continuous” from “my_functions.py” and “Bar2D” from “my_class.py”, i get some warning.
how can i overcome from this trouble?