Python Forum

Full Version: Unable to import my own module
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,

I am relatively new to python but I am trying to use it more extensively for post-processing of fluid mechanics data.
I am currently working under Windows 10 and I am using Spyder (Python 3.7). I created my own module Plottings.py which contains some plotting functions. Once I created the module I copied it in: C:\Users\ThePhantom\AppData\Local\Programs\Python\Python38-32\Lib\site-packages

Now, wherever I am located if I open Spyder and type:
import Plottings as myPlot
myPlot.
Pressing Tab I can actually see all the functions contained in Plottings (which means that the module is visible) BUT when I run it, it gave me back this error:
ModuleNotFoundError: No module named 'Plottings'
The only way I could solve this problem is to include Plottings.py in the folder where I am running the test case.
I appreciate your help. Thanks!
The approached I used made a folder in the same folder as the main script. Place my module in the new folder then to import, from my_new folder import my file.
Thanks for the answer. However, I would like to know if there is any way to import your module without having to have it in the same running folder.
Sorry, I misread what you were asking. If it's in the python path it should import