Getting file path of imported module [duplicate]

Modules and packages have a __file__ attribute that has its path information. If the module was imported relative to current working directory, you’ll probably want to get its absolute path.

import os.path
import my_module

print(os.path.abspath(my_module.__file__))

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)