From a class called heatnet I like to return instance A stored in list[0]. In the Main file I like to call all functions that are related to the instance. This functions shall be shown from the autocomplete by spyder or PyCharm. Tried rope, jedi etc. The run works but not the autocomplete at writing.
from Pipe import Pipe
class Heatnet(object):
def __init__(self, iteminstance):
print(iteminstance)
self.list = []
self.list.append(Pipe(iteminstance[0], iteminstance[1]))
def pipes(self, i = slice(None, None)):
return self.list[i]
class Pipe:
def __init__(self, x, y):
self.x = x
self.y = y
def area(self):
return self.x * self.y
heatnet.pipes(0).area()
I solved it: Dont make list of instances private. If it is protected or public autocompletion works properly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.