In fileA.py
I have the following: ( I simplified the code)
class ControlArmPositional():
def __init__(self):
self.xml_trayectory_right=[]
self.xml_trayectory_left=[]
self.user_storedpoints_left=0
self.user_storedpoints_right=0
def ApplyTrajectoryPointsRight(self):
print("ApplyTraject Right Inside")
for i in range(self.user_storedpoints_right):
self.hiro.setTargetPose('rarm',[self.xml_point_right[i][0],self.xml_point_right[i][1],self.xml_point_right[i][2]],[self.xml_point_right[i][3],self.xml_point_right[i][4],self.xml_point_right[i][5]], 2)
if __name__=='__main__':
arm_positional =ControlArmPositional()
arm_positional.main()
else:
print 'I am being imported from another module'
In fileB.py
from folder1.fileA import *
global arm_positional
arm_positional =ControlArmPositional()
class MyPlugin(Plugin):
...
def push_button_dotrayectoryright(self):
if (self.status_start== True):
arm_positional.ApplyTrajectoryPointsRight()
All files running same time. If I change something on fileA I want change it in fileB and same if change something on fileB see that change on fileA.
My problem is when I save points on fileA, for example 5 points , when I call in fileB the method that belongs to fileA the number of points is 0.
I also tried to use set and get functions but no work.
Any idea? Can I use same object on an external class?
Thanks a lot