Python Forum
package script cant find sibling script when executed from outside
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
package script cant find sibling script when executed from outside
#3
(Mar-03-2023, 11:12 AM)Bock Wrote: Unfortunately i get the error message: "no module named 'constant' "
According to your post, the module is named 'constants' and not 'constant'. Could this be the error?

You could try a relative import in function.py
from .constants import my_const
Note that 'relative' import means relative to the python packages hierarchy, not the file system's directories tree.
Reply


Messages In This Thread
RE: package script cant find sibling script when executed from outside - by Gribouillis - Mar-03-2023, 01:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Music Python Script Repeating Number When Saving Facebook Photos ThuanyPK 2 172 May-13-2024, 10:59 PM
Last Post: ebn852_pan
  Trying to generating multiple json files using python script dzgn989 4 270 May-10-2024, 03:09 PM
Last Post: deanhystad
  Problems passing arguments containing spaces to bash script and then on to python kaustin 6 539 Apr-03-2024, 08:26 PM
Last Post: deanhystad
  Using a script to open multiple shells? SuchUmami 9 687 Apr-01-2024, 10:04 AM
Last Post: Gribouillis
  How to include one script into another? MorningWave 8 603 Mar-21-2024, 10:34 PM
Last Post: MorningWave
  ChromeDriver breaking Python script genericusername12414 1 386 Mar-14-2024, 09:39 AM
Last Post: snippsat
  using PowerShell from Python script for mounting shares tester_V 8 661 Mar-12-2024, 06:26 PM
Last Post: tester_V
  No Internet connection when running a Python script basil_555 8 815 Mar-11-2024, 11:02 AM
Last Post: snippsat
Question Running Python script through Task Scheduler? Winfried 8 725 Mar-10-2024, 07:24 PM
Last Post: Winfried
  Combine console script + GUI (tkinter) dejot 2 501 Feb-27-2024, 04:38 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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