\ProvidesPackage{import}
\@primitives{import}
\newcommand{\@imp@dir}{}
\hva@newstack{@imp}
\newcommand{\@imp@import}[3]
{%
\@imp@set{#2}%
\@push@imp{\@imp@dir}%
\renewcommand{\@imp@dir}{#2}%
#1{#3}%
\@pop@imp{\@imp@dir}%
\@imp@set{\@imp@dir}%
}
\newcommand{\import}[2]{\@imp@import{\input}{#1}{#2}}
\newcommand{\includefrom}[2]{\@imp@import{\include}{#1}{#2}}
%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\@imp@sub}[3]
{%
\@push@imp{\@imp@dir}%
\prim@def\@imp@dir{\@imp@dir{}#2}%
\@imp@set{\@imp@dir}%
#1{#3}%
\@pop@imp{\@imp@dir}%
\@imp@set{\@imp@dir}%
}
\newcommand{\subimport}[2]{\@imp@sub{\input}{#1}{#2}}
\newcommand{\subincludefrom}[2]{\@imp@sub{\include}{#1}{#2}}
%%%%


