\newcommand{\basedir}{.}

\ExplSyntaxOn

\DeclareDocumentCommand{\setBasedir}{}{
    \exp_args:Nnf\SetExerciseProperty{basedir}{\basedir}%
}

\DeclareDocumentCommand{\aufgabeninput}{mm}{
    \DeclareDocumentCommand{\basedir}{}{#1}
    \input{#1/#2}
}
\DeclareExerciseProperty-{basedir}

\DeclareDocumentCommand{\getBasedir}{}{
    \GetExerciseProperty{basedir}
}
\xsimsetup{
  aufgabe/begin-hook = \setBasedir,
}
\ExplSyntaxOff