If I import a python module using a syntax like this:
import my_module
I can later use a number of simplest command to get an idea of what the module is, where it is located and etc. For example:
print(my_module)
outputs: module 'my_module' from 'my_module.py'
dir(my_module)
outputs: ['MyClass', 'builtins', 'doc', 'file', 'name', 'package', 'math', 'os', 'sys']
I even can find out an absolute path of the module by using:
print os.path.abspath( my_module.__file__ )
outputs: /Users/julia/Documents/classes/my_module.py
But if instead of import 'my_module' I would be using:
from my_module import MyClass
all I can is to:
print MyClass
which outputs: my_module.MyClass
I do see MyClass came from my_module file. But unfortunately that is all I can get since none of the commands I used to use to get the info on module doesn't work. Here is use and their output:
print dir(my_module.MyClass) NameError: name 'my_module' is not defined
print dir(my_module) NameError: name 'my_module' is not defined
print my_module name 'my_module' is not defined
What command(-s) should I be using while tracking down the imported modules brought with
from my_module import MyClass
syntax?