Python doesn't check if your file is a symlink or not! Your problem lies probably in renaming the modules or not having them in your search-path!
If ModuleA becomes ModuleB and you try to import ModuleA it can't find it, because it doesn't exist.
If you moved ModuleA into another directory and you generate a symlink with another name, which represents a new directory, this new directory must be the common parent directory of your script and your module, or the symlink directory must be in the search path.
BTW it's not clear if you mean module or package. The directory containing the __init__.py
file becomes a package of all files with the extension .py
(= modules) residing therein.
Example
DIRA
+ __init__.py <-- makes DIRA to package DIRA
+ moduleA.py <-- module DIRA.moduleA
Moving and symlink
/otherplace/DIRA <-+
| points to DIRA
mylibraries/SYMA --+ symbolic link
If SYMA has the same name as DIRA and your script is in the directory SYMA then it should just work fine. If not, then you have to:
import sys
sys.path.append('/path/to/your/package/root')
If you want to import a module from your package SYMA you must:
import SYMA.ModuleA
A simple:
import SYMA
will import the packagename, but not the modules in the package into your namespace!