Unfortunately, you don't. That is part of how the import syntax works and it is important that it does so -- remember def
is actually something executed, if Python did not execute the import, you'd be, well, stuck without functions.
Since you probably have access to the file, though, you might be able to look and see what causes the error. It might be possible to modify your environment to prevent the error from happening.