Move image "object has no attribute 'isHome'"

I get these errors when I use the following script! What's the problem here?

"AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'isHome'"


image = event.source.parent.getComponent('Image')

if image.isHome:
// Save Original position
image.initialX = image.x
image.initialY = image.y
// Some kind of calculation
newX = image.x + 500
newY = image.y + 100
// Move Image
system.gui.transform(image,newX, newY, duration=250)
// Image is not in original location anymore
image.isHome = 0
else:
// Go back to original position
system.gui.transform(image,image.initialX, image.initialY, duration=250)
image.isHome = 1

{ Please format your code with the "Preformatted Text" button in the forum editor so we can see it properly. Use the edit button to fix it in place--the pencil icon under your post. }

What is isHome ? A custom property on the Image component? Or elsewhere, perhaps? And where is this script? (What component, what event on that component?)

{ I shortened the title to be more forum-friendly, and added the Vision tag. }

1 Like

You're image component (not sure what it is, probably an image) does not have a isHome attribte which you are trying to call with image.isHome. You can check out what attributes or methods are available with your component by getting the component with script console and using dir on it or @pturmel inspect function.