Unit 3 Custom Interface import problem

i have a problem in unit 3
after making a new custom interface i wanted to use this interface in my code as the tutorial said. in example 3.6
when i try to import it it seems that the IDE hightlights the from command.

I created the custom interface as the the tutroial said.

  1. create package inside src dir
  2. create msg dir inside the package dir
  3. create Age.msg and edit it
  4. modify the CMake and xml files.
  5. compile and source
  6. checking if it was okay

The result was good

Using the new interface

  1. creating a new package inside src called example36_pkg with the desired dependencies inculding the custom_interface.msg
  2. create the python file. when i write the code i see the error
  3. if i contiune and making the launch file and editing the setup, compile it and source it
    when im shuting it down there error arrives that say
[example36-1] AttributeError: 'Age' object has no attribute 'year'

it make sense because couldnt import the Age package.

Would like for some help
Thank you

Hello @noam92 ,

Sometimes the IDE highlits error in the importing of messages despite not being real errors. We are looking into this issue.

However, you are trying to access the attribute year from the Age message. But the Age message doesn’t have any attribute named year, it is named years instead (you can check this by looking at the Age message definition). This might be the reason of your error.

1 Like