diff --git a/src/ifcopenshell-python/ifcopenshell/entity_instance.py b/src/ifcopenshell-python/ifcopenshell/entity_instance.py index 078047790a..ea58268322 100644 --- a/src/ifcopenshell-python/ifcopenshell/entity_instance.py +++ b/src/ifcopenshell-python/ifcopenshell/entity_instance.py @@ -48,7 +48,7 @@ class entity_instance(object): >>> #423=IfcProductDefinitionShape($,$,(#409,#421)) """ - def __init__(self, e, file): + def __init__(self, e, file=None): if isinstance(e, tuple): e = ifcopenshell_wrapper.new_IfcBaseClass(*e) super(entity_instance, self).__setattr__("wrapped_data", e) @@ -126,7 +126,7 @@ class entity_instance(object): return entity_instance.wrap_value(self.wrapped_data.get_argument(key), self.wrapped_data.file) def __setitem__(self, idx, value): - if self.wrapped_data.file.transaction: + if self.wrapped_data.file and self.wrapped_data.file.transaction: self.wrapped_data.file.transaction.store_edit(self, idx, value) attr_type = real_attr_type = self.attribute_type(idx).title().replace(" ", "")