Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8873581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:30:07+00:00 2026-06-14T18:30:07+00:00

I have a Python script in a file stored in a Folder MyFolder. Tree

  • 0

I have a Python script in a file stored in a Folder MyFolder. Tree structure for the file system is the following

MyFolder
    - Image
          - scipt_image.py
    - script.py
    - script_test.py

I want to use scripts in Image, scipt_image.py, in script script.py. To include this script_image.py, I use this :

import os, sys
DATA_DIR = os.path.abspath(os.path.join(os.getcwd(), 'Image'))
sys.path.append(DATA_DIR)

Then, i import script_image.py, with

import scipt_image

From errors at compilation, this seems not be working. However, problem may come from something else. Does this sounds correct ?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:30:08+00:00Added an answer on June 14, 2026 at 6:30 pm

    Is there a specific reason you don’t simply use the Image folder as a python package and import the file directly without messing with sys.path?

    I would simply turn Image into a python package (create an empty file named __init__.py in Image) and then import script_image like this:

    from Image import script_image
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently switched from python 2.7 to python 3.2 considering following folder structure:
I have a Python script that reads through a text csv file and creates
I have an existing python script that, among other things checks a file against
I have a batch file containing a python script using the Output template> %(NAME)s
I have a very simple python script that should scan a text file, which
Let's assume I have a main script, main.py, that imports another python file with
I have a python script that I want always to run in the background.
I have a text file which has the following structure: 341|18 Hello world|20090225230048AAnhStI|90|$0.30|10|289|2|2|2|Is that
I have a Python script which processes a .txt file which contains report usage
I have a batch file that runs several python scripts that do table modifications.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.