Self.filepath vs self.properties.filepath

What are the difference? Both seem to work completely fine in my script and seem to be interchangeable.

I’m using it in conjunction with bpy_extras.io_utils.ExportHelper. I get the output file/directory selected by the user and have my script call a method in another file with that info, passing “self” as the argument from the ExportHelper (I keep Blender GUI-related code isolated from my various scripts). The actual script then access the ExportHelper info via self.filepath / self.properties.filepath.

I like to keep code as short and readable as much as possible (i.e., self.filepath), but not sure if there’s any functional differences between the above two approaches.

I don’t know about this specific property, but what you can do is trying to do :

print((self.filepath is self.properties.filepath))

If it returns True you can consider that it’s the same, and use either the one or another.
Otherwise, there must be a difference, in some cases…

(If you don’t know difference between is and == :

  • == compares the value (if both A and B equal 10 then A==B is True )
  • is compares the pointer, meaning A is B is True only when pointing to the same object in the memory )

See you :slight_smile: ++
Tricotou

Thanks.

I just tried it and the value returned is False when I use “is” and True when I use “==”. I found the following site stating:

“The addition of the ImportHelper/ExportHelper, a new attribute is defined in the self.properties of the operator (filepath).”

In another comment on the same site:

“Open browser, take reference to ‘self’ read the path to selected file, put path in predetermined data structure self.filepath”.

Still unclear what the difference is.