# import in \newcommand in my package produces an error

I have written and installed my own package gym.sty. In that package I defined

\newcommand{\loadgym}{\import{sagegym}}


since I need to execute some commands after \begin{document} for the package to be fully working. I tested it in a document that basically consists of

\usepackage{gym}
\begin{document}
\end{document}


The package all works fine and does all it is supposed to do including the \loadgym command. But it produces an error message which is annoying though harmless:

Paragraph ended before \@import was complete


Is there any way to avoid this error message? I do not know if it is relevant, but gym.sty and sagegym.tex are located in MiKTeX package folders whereas the document implementing the code is located elsewhere.

-
Welcome to TeX.sx! Can you show a bit of context about your usage of \loadgym? A minimal working example (MWE) is needed. –  egreg Mar 17 '13 at 16:55

You haven't given an example or said which packages you are using, but I would guess you are using \import from the import package. According to the comments in the file the usage is

\import{/usr5/friend/work/}{report}


That is, it has two arguments and you have only used one.

-
It puzzled me too that it worked using only one argument. But the nice thing is that somehow my import-command finds sagegym.tex which is located in my package folder for the package gym.sty. How would I do that if I were to specify a path as first argument? –  Eskil Mar 17 '13 at 17:14
@Eskil sorry I don't have enough information to answer the question. Why do you need \import at all if the file is in your package folder it is presumably in tex's input path (if the package is found) so you could just use the standard latex \input{sagegym} –  David Carlisle Mar 17 '13 at 17:36
I tried \input first. It said sagegym.tex not found. –  Eskil Mar 17 '13 at 17:40
@Eskil there is something you are not telling us (which is why we always ask for complete example code) If \usepackage{gym} finds gym.sty and sagegym.tex is in the same directory as gym.sty then \input{sagegym} will work. If it does not work, post a complete small document that shows the problem (including the smallest version of gym.sty that you can make that shows the problem) and post the full error message you get from TeX. –  David Carlisle Mar 17 '13 at 17:44
Right now I have no idea why it worked - I just tried to comment out irrelevant parts to submit a complete small version of my codes. But it did not work properly. I will ask a new question instead that tells what I am really trying to do. Thanks for your help! –  Eskil Mar 17 '13 at 20:48