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 986779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:22:27+00:00 2026-05-16T05:22:27+00:00

So I have two files: File 1 has this method in it: import MyGlobals

  • 0

So I have two files:
File 1 has this method in it:

import MyGlobals
global old_function
def init():
    import ModuleB
    global old_function
    MyGlobals.SomeNumber = 0
    old_function = ModuleB.someClass.function
    ModuleB.someClass.function = someNewFunction

File 2 has a class “someClass” and a class “someOtherClass”. That being said.
When I run my code on my computer it works great and it does what I expect it to. When I run this code on my friends computer which is the same build of windows 7 with the same python version 2.5.4, and with the same code(on a thumb drive for both) it gets an error “Module does not contain someClass”

I hope this makes sense in what I am trying to say. It is work related therefore code snippets aren’t aloud. This one has me extremely stumped on why this would be the case. I even tried “from ModuleB import someClass” to see if someClass would work, but it still said that someClass is not in moduleB, while someCLass is definitely in moduleB…

Any ideas would greatly be appreciated!

  • 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-05-16T05:22:28+00:00Added an answer on May 16, 2026 at 5:22 am

    Well, it’s fairly clear that you are using different versions of ModuleB. I would hazard a guess that even though you are running the code from a thumb drive, you have put ModuleB.py somewhere else in your PYTHONPATH and it is running that version on your computer, but not on your friend’s. This is easy to check:

    import ModuleB
    print ModuleB.__file__
    

    I’ll bet that doesn’t print what you’re expecting!

    On a different note, you don’t need the first global declaration in your code snippet — that’s already the global scope.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two files: master/newsletter1/file.html master/newsletter2/file.html newsletter1/file.html has a lot of new changes that
I have two files: domainList and config.cnf. The domainList file simply has a list
I have two 3GB text files, each file has around 80 million lines. And
I have two csv file. First File has date offerid clicks orders Second File
I have two text file. file1.txt has: gedit google chrome git vim foo bar
If I have two css files: File 1: .colorme { background-color:Red; } File 2:
I have two files client.php and server.php. The client file send a HTTP request
I have two files A - nodes_to_delete and B - nodes_to_keep . Each file
hi guys i have two pipe delimited files,first file contains 1000 records and second
I have two plain html files. The first has a tree on the left

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.