Olya
0
Q:

python import class

# In the examble bellow we will import the class MyClass from the file MyFile

from MyFile import MyClass
3
from <file that has the class in> import <the class name you want to import>

# Or do this if you want to import everything inside one file
from <file that has the class in> import *
2
#from your main script

from folder.file import Klasa

#OR

from folder import file
k = file.Klasa()

#OR

import folder.file as myModule
k = myModule.Klasa()
0

New to Communities?

Join the community