diff --git a/src/opera/parser/tosca/__init__.py b/src/opera/parser/tosca/__init__.py
index 74ba731..ca5a888 100644
--- a/src/opera/parser/tosca/__init__.py
+++ b/src/opera/parser/tosca/__init__.py
@@ -24,7 +24,7 @@ def load(base_path, template_name):
 
     stdlib_yaml = stdlib.load(tosca_version)
     service = parser.parse(stdlib_yaml, base_path, PurePath("STDLIB"))
-    service.merge(parser.parse(input_yaml, base_path, PurePath()))
+    service.merge(parser.parse(input_yaml, base_path, template_name.parent))
     service.visit("resolve_path", base_path)
     service.visit("resolve_reference", service)
 

Some files linked to the main TOSCA yaml are not accessible to the orchestrator. 
In the case of the CSAR-tree, the orchestrator ignores the referenced file defined in the main TOSCA yaml and returns a

`[Path] Path <path to the file> does not exist.`

type of error. The referenced file is in the same folder then the main file.

diff --git a/tests/opera/parser/test_tosca.py b/tests/opera/parser/test_tosca.py
index c74fd47..f7a5426 100644
--- a/tests/opera/parser/test_tosca.py
+++ b/tests/opera/parser/test_tosca.py
@@ -1,3 +1,5 @@
+import pathlib
+
 import pytest
 
 from opera.error import ParseError
@@ -6,17 +8,19 @@ from opera.parser import tosca
 
 class TestLoad:
     def test_load_minimal_document(self, tmp_path):
-        root = tmp_path / "root.yaml"
-        root.write_text("tosca_definitions_version: tosca_simple_yaml_1_3")
+        name = pathlib.PurePath("root.yaml")
+        (tmp_path / name).write_text(
+            "tosca_definitions_version: tosca_simple_yaml_1_3",
+        )
 
-        doc = tosca.load(root.parent, root.name)
+        doc = tosca.load(tmp_path, name)
         assert doc.tosca_definitions_version.data == "tosca_simple_yaml_1_3"
 
     def test_empty_document_is_invalid(self, tmp_path):
-        root = tmp_path / "root.yaml"
-        root.write_text("{}")
+        name = pathlib.PurePath("empty.yaml")
+        (tmp_path / name).write_text("{}")
         with pytest.raises(ParseError):
-            tosca.load(root.parent, root.name)
+            tosca.load(tmp_path, name)
 
     @pytest.mark.parametrize("typ", [
         ("data_types", "tosca.datatypes.xml"),
@@ -29,10 +33,12 @@ class TestLoad:
         ("policy_types", "tosca.policies.Root"),
     ])
     def test_stdlib_is_present(self, tmp_path, typ):
-        root = tmp_path / "root.yaml"
-        root.write_text("tosca_definitions_version: tosca_simple_yaml_1_3")
+        name = pathlib.PurePath("stdlib.yaml")
+        (tmp_path / name).write_text(
+            "tosca_definitions_version: tosca_simple_yaml_1_3",
+        )
 
-        doc = tosca.load(root.parent, root.name)
+        doc = tosca.load(tmp_path, name)
         assert doc.dig(*typ) is not None
 
     @pytest.mark.parametrize("typ", [
@@ -46,8 +52,8 @@ class TestLoad:
         ("policy_types", "tosca.policies.Root"),
     ])
     def test_custom_type_is_present(self, tmp_path, yaml_text, typ):
-        root = tmp_path / "root.yaml"
-        root.write_text(yaml_text(
+        name = pathlib.PurePath("custom.yaml")
+        (tmp_path / name).write_text(yaml_text(
             """
             tosca_definitions_version: tosca_simple_yaml_1_3
             {}:
@@ -56,12 +62,12 @@ class TestLoad:
             """.format(*typ)
         ))
 
-        doc = tosca.load(root.parent, root.name)
+        doc = tosca.load(tmp_path, name)
         assert doc.dig(typ[0], "my.custom.Type") is not None
 
     def test_loads_template_part(self, tmp_path, yaml_text):
-        root = tmp_path / "root.yaml"
-        root.write_text(yaml_text(
+        name = pathlib.PurePath("template.yaml")
+        (tmp_path / name).write_text(yaml_text(
             """
             tosca_definitions_version: tosca_simple_yaml_1_3
             topology_template:
@@ -71,5 +77,27 @@ class TestLoad:
             """
         ))
 
-        doc = tosca.load(root.parent, root.name)
+        doc = tosca.load(tmp_path, name)
         assert doc.topology_template.node_templates["my_node"] is not None
+
+    def test_load_from_csar_subfolder(self, tmp_path, yaml_text):
+        name = pathlib.PurePath("sub/folder/file.yaml")
+        (tmp_path / name).parent.mkdir(parents=True)
+        (tmp_path / name).write_text(yaml_text(
+            """
+            tosca_definitions_version: tosca_simple_yaml_1_3
+            imports:
+              - imp.yaml
+            """
+        ))
+        (tmp_path / "sub/folder/imp.yaml").write_text(yaml_text(
+            """
+            tosca_definitions_version: tosca_simple_yaml_1_3
+            data_types:
+              my_type:
+                derived_from: tosca.datatypes.xml
+            """
+        ))
+
+        doc = tosca.load(tmp_path, name)
+        assert doc.data_types["my_type"]

pip install -e .[openstack]
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y python3-venv python3-wheel python-wheel-common
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
ansible==4.10.0
ansible-core==2.11.12
certifi @ file:///croot/certifi_1671487769961/work/certifi
cffi==1.15.1
charset-normalizer==3.4.1
cryptography==44.0.2
decorator==5.1.1
dogpile.cache==1.2.2
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
iso8601==2.1.0
Jinja2==3.1.6
jmespath==1.0.1
jsonpatch==1.33
jsonpointer==3.0.0
keystoneauth1==5.1.3
MarkupSafe==2.1.5
netifaces==0.11.0
openstacksdk==3.3.0
-e git+https://github.com/xlab-si/xopera-opera.git@e9021b120df76e783baa3f56c9bedca2ecb97847#egg=opera
os-service-types==1.7.0
packaging==24.0
pbr==6.1.1
platformdirs==4.0.0
pluggy==1.2.0
pycparser==2.21
pytest==7.4.4
PyYAML==6.0.1
requests==2.31.0
requestsexceptions==1.4.0
resolvelib==0.5.4
six==1.17.0
stevedore==3.5.2
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: xopera-opera
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - ansible==4.10.0
      - ansible-core==2.11.12
      - cffi==1.15.1
      - charset-normalizer==3.4.1
      - cryptography==44.0.2
      - decorator==5.1.1
      - dogpile-cache==1.2.2
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - iso8601==2.1.0
      - jinja2==3.1.6
      - jmespath==1.0.1
      - jsonpatch==1.33
      - jsonpointer==3.0.0
      - keystoneauth1==5.1.3
      - markupsafe==2.1.5
      - netifaces==0.11.0
      - openstacksdk==3.3.0
      - os-service-types==1.7.0
      - packaging==24.0
      - pbr==6.1.1
      - platformdirs==4.0.0
      - pluggy==1.2.0
      - pycparser==2.21
      - pytest==7.4.4
      - pyyaml==6.0.1
      - requests==2.31.0
      - requestsexceptions==1.4.0
      - resolvelib==0.5.4
      - six==1.17.0
      - stevedore==3.5.2
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/xopera-opera

tests/opera/parser/test_tosca.py::TestLoad::test_load_from_csar_subfolder
tests/opera/parser/test_tosca.py::TestLoad::test_load_minimal_document tests/opera/parser/test_tosca.py::TestLoad::test_empty_document_is_invalid tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ0] tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ1] tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ2] tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ3] tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ4] tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ5] tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ6] tests/opera/parser/test_tosca.py::TestLoad::test_stdlib_is_present[typ7] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ0] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ1] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ2] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ3] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ4] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ5] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ6] tests/opera/parser/test_tosca.py::TestLoad::test_custom_type_is_present[typ7] tests/opera/parser/test_tosca.py::TestLoad::test_loads_template_part
src/opera/parser/tosca/__init__.py
src/opera/parser/tosca/__init__.py