How to \import* without breaking other packages?

I am struggling to set up the package import properly. Here is what I am doing:

The main file includes another file with a very common name. To make sure that the correct file is loaded, I use \import* instead of \import.

For some reason this breaks the functionality of amsfonts. I get the warnings shown below and the output file just contains a plain a.

Can anyone help me out?

./main.tex

\documentclass{article}

\usepackage{amsfonts}
\usepackage{import}

\begin{document}
\import*{./}{generic_name.tex}
\end{document}


./generic_name.tex

$\mathfrak{a}$


Warnings

(./generic_name.tex

LaTeX Font Warning: Font shape U/msa/m/n' undefined
(Font)              using U/cmr/m/n' instead on input line 1.

LaTeX Font Warning: Font shape U/msb/m/n' undefined
(Font)              using U/cmr/m/n' instead on input line 1.

LaTeX Font Warning: Font shape U/euf/m/n' undefined
(Font)              using U/cmr/m/n' instead on input line 1.

) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./main.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

)</usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>

• import generally causes more problems than it solves, it is not at all clear why you can not go \input{./generic name} it will get the one from the current directory which seems to be exactly what you want \import to do. – David Carlisle Sep 20 '16 at 22:03
• I just switched from \input to \import. So I can't yet tell if your general rule applies to my case. My real document is split into files ./main.tex, ./chapterN/main.tex, ./chapterN/img/ etc. Some images are TeX-files (they use \includegraphics, but do not know about the document structure). This is why I had to provisionally add ./chapterN/img/ to TEXINPUTS for each chapter. With \import I no longer need to do this. – Johnny TeX Sep 20 '16 at 22:52

I think this is due to LaTeX's delayed method of handling math fonts. Thus, the use of \mathfrak inside generic_name.tex triggers an input of ueuf.fd (and other font definition files). But the import package forces imported files to look for their input files in that given directory, where ueuf.fd does not exist.
I don't see a complete solution without a rewrite of import.sty (or maybe amsfonts.sty), but this particular problem can be worked around by putting the following in the preamble, probably after \usepackage{amsfonts}:
\input{ueuf.fd}