I am new to PyCharm and am having difficulty importing modules that I have written into the Python console. If I try to import a module that is native to Python I can import that module without difficulty but if I try to import a module that I have written I get an ImportError: No module named 'ModuleITriedToImportName'. For instance here is a simple self written module to pickle files called "filepickle":
import pickle
def saveDbase(filename, object):
file = open(filename, 'wb')
#pickle.dump(object, file) # pickle to file
#pickle.dump(object, open(filename, 'wb'))
pickle.dump(object, file)
file.close() # any file-like object will do
def loadDbase(filename):
file = open(filename, 'rb')
object = pickle.load(file) # unpickle from file
file.close() # recreates object in memory
return object
If I try to "import pickle" at the PyCharm Python Console then the import works without any error. If I try to "import filepickle" I receive the error message:
ImportError: No module named 'filepickle'
The module filepickle works just fine if I run filepickle within PyCharm but I am unable to import filepickle in the Python console. If anybody knows how to get PyCharm to allow me to import modules that I have written into the PyCharm Python console I would appreciate the help.