Python Forum
Problem with importing Python file in Visual Studio Code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with importing Python file in Visual Studio Code
#1
Hello here ! I'm learning how to code starting with Python, and I'm facing a problem trying to import a file as a module. With this code :

import os
import sys
sys.path.append(os.getcwd()+"\launch")
import launch as l
I'm getting the issue "Import "launch" could not be resolved", and if I execute the script, the error "ModuleNotFoundError : No module named 'launch'". I'm struggling with this for a few hours now, and I'm quite desperate, so thanks in advance for your answers !

Of course, with the command :

os.popen(os.getcwd()+"\launch")
I can open my file, so it's not a problem of wrong path.
Reply


Messages In This Thread
Problem with importing Python file in Visual Studio Code - by DXav - Jun-14-2022, 10:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem Converting Tradingview Indicator to Python code kralxs 1 297 Apr-27-2024, 06:10 PM
Last Post: kralxs
  Python Coding in Power BI Visual vjrans 0 316 Jan-31-2024, 07:54 AM
Last Post: vjrans
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,125 Nov-15-2023, 06:56 PM
Last Post: jst
  How to set PYTHONPATH in Visual Studio Code? aupres 5 4,514 Aug-15-2023, 03:51 PM
Last Post: snippsat
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 948 Jun-26-2023, 09:40 AM
Last Post: snippsat
  Visual Studio Code NewPi 3 1,095 May-16-2023, 11:13 PM
Last Post: snippsat
  New2Python: Help with Importing/Mapping Image Src to Image Code in File CluelessITguy 0 742 Nov-17-2022, 04:46 PM
Last Post: CluelessITguy
  python standard way of importing library mg24 1 936 Nov-15-2022, 01:41 AM
Last Post: deanhystad
  Visual Studio Code venv ibm_db error mesi1000 7 2,895 Nov-13-2022, 12:36 AM
Last Post: snippsat
  Problem with importing python-telegram library into the project gandonio 1 1,622 Nov-01-2022, 02:19 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020