Why do you need to limit what is specified for a module? dir()- debugging tool, basically.
Magic methods usually look for the type of object, so they dir()look for instances type(instance).__dir__. Your function is not a type module, but rather a module instance. However, you cannot extend the type module, so you cannot provide the module with its own method __dir__.
from yourmodule import *, __all__; , , . . import.