Runtime error :'NoneType'--- DistanceTo--Random direction

By looking at the example below, I want to find the distance between the two point lists and give the agents random direction according to the distances I have determined. But I get the error “Runtime error (MissingMemberException): ‘NoneType’ object has no attribute ‘X’ Traceback: line 20, in script”. Also, is it possible to redirect points with distance j instead of the code in this line randomly?

"move_agents =
for j in range (len (obs_agents)):
obs_agents = rs.MoveObject (22.571388, 2.927514, 0)
move_agents.append (obs_agents)
print move_agents "

Please help me fix errors?

import rhinoscriptsyntax as rs
import Rhino
import random
import math

agents = rs.coerce3dpoint(agents_)
obstacles = rs.coerce3dpoint(obstacles_)

calc=math.sqrt((obstacles.X-agents.X)**2 + (obstacles.Y-agents.Y)**2 + (obstacles.Z-agents.Z)**2)

for i in range(len(disagent)):
    if disagent[i] < 8.00:

#print agent_index

for j in range(len(disobs)):
    if disobs[j] < 100.00:
#print obs_index

for i in agent_index:
    print i
    print agents[i]

print close_agents

obs_agents = []
for j in obs_index:
    print j
    print disobs[j]

move_agents = []
for j in range(len(obs_agents)):
    obs_agents = rs.MoveObject(22.571388, 2.927514, 0)

print move_agents

You need to first supply proper input, and second, set the input to the proper type.

I connected the inputs in the appropriate type, but now it gives this error.
“Runtime error (TypeErrorException): object of type ‘float’ has no len () Traceback: line 31, in script”

You need to set the input access to ListAcess.

He returned to the initial mistake again. I wonder if I should define “X” in this line. Actually, there was no operation in the example I looked at.
"calc = math.sqrt ((obstacles.X-agents.X) ** 2 + (obstacles.Y agents.Y) ** 2 + (obstacles.Z-agents.Z) ** 2) disobs = agents.DistanceTo (obstacles) "

I’m not sure if line 21 is even important because nowhere else in the code the calc variable is used.
If you give more information about the result you’re looking for, it would be easier to help.

I define two point groups as “obstacles” and “agents”. I also defined the “agents” 'distance within them as “disagent”. I want the agents to change direction randomly when their distance from obstacles is below 100.00. Finally, I would like to group and export the “agents” whose distances are less than 8.00 and the points away from the “obstacles” that I give random directions.My working file is attached. I use Physarealm.
21.02.2020-pinar.3dm (38.2 KB) 24.03.2020-sonçalış (34.8 KB)

Do you have any suggestions?