Importing packages/modules

Hi all,

I try to import a module in PyCharm.
The module is in an separate folder (package) with subfolders...

Maybe this is a simple question for many programmers here, but how do I import the module into my project in order to use a Class, defined in the module.



To be a bit more specific:

(1) I have a package 'pythonds' which is a folder with several subfolders containing modules

(2) The path to pythonds is:
         
        E:\Tutorials\Python Tutorials\Bioinformatics_Algorithms/pythonds

(3) Among several subfolders there is the folder 'graphs' which contains the module 'adjGraph.py'

        E:\Tutorials\Python Tutorials\Bioinformatics_Algorithms\pythonds\graphs\adjGraph.py

(4) The module adjGraph.py contains a class I would like to import:

        I would like to import the class 'Graph' which is defined in the module adjGraph.py



Thank you very much in advance,

Best,
Werner
1 comment
Comment actions Permalink
Hi Werner. Sorry, just seeing this one. Your intermediate folders (pythonds, graphs) need a file named __init__.py to make them into "packages".
0

Please sign in to leave a comment.