AbsoluteMadMan's Posts
Nairaland Forum › AbsoluteMadMan's Profile › AbsoluteMadMan's Posts
1 (of 1 pages)
Who needs WWE |
Let's say you have a folder myprogram and this is your working directory. These are the ways you can import modules in that folder. with a file myfolder/main.py you can import using import main # or from .main import x with a file myfolder/myprogram/__init__.py, and another myfolder/myprogram/main.py where the content of myfolder/myprogram/__init__.py is from .main import MyClass you can do: import myprogram cls = myprogram.MyClass() # or from myprogram import MyClass cls = MyClass() |
1 (of 1 pages)