this has bee driving me nutz for the past few hours. 2 modules are in the same directory. I want to be able to use them both:
[code] [az@hp tst1]$ pwd /home/az/Dropbox/work/Prjs/tst1 [az@hp tst1]$ ls -l total 16 -rw-rw-r--. 1 az az 66 Jul 7 12:58 db.py -rw-rw-r--. 1 az az 182 Jul 7 15:54 uno.py [az@hp tst1]$ [az@hp tst1]$ [az@hp tst1]$ cat ./db.py class DB(): def __init__(self): print("I'm DB") [az@hp tst1]$ cat ./uno.py from . import db class Uno(): def __init__(self): print("I'm uno") self.db = db.DB() def printing(self): print("Uno.printing DB") if __name__ == '__main__': uno = Uno() [az@hp tst1]$ [az@hp tst1]$ [az@hp tst1]$ python3 ./uno.py Traceback (most recent call last): File "./uno.py", line 1, in <module> from . import db SystemError: Parent module '' not loaded, cannot perform relative import [/code] Much obliged. -- https://mail.python.org/mailman/listinfo/python-list