Python Forum
using import with filename starting by a number followed by underscore
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using import with filename starting by a number followed by underscore
#1
Hi everyone,

I have a file who is named 16_module.py

I would like to use some function from it. So i use import within my current script file
import 16_module
but this is not working as python see it as a number with an ending thousand separator Doh

so I use instead
importlib.import_module('16_module')
The import seem working but I cannot call it later on
print(16_module.myfunction())
Output:
invalid decimal literal
same problem here the thoushand separator..

I tried
importlib.import_module('16_module') as test
but this is not accepting the AS ....

any ideas ?
[Image: NfRQr9R.jpg]
Reply


Messages In This Thread
using import with filename starting by a number followed by underscore - by SpongeB0B - Apr-02-2020, 05:12 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The function of double underscore back and front in a class function name? Pedroski55 9 883 Feb-19-2024, 03:51 PM
Last Post: deanhystad
  Python 2.7 Import error. Directory and filename conflict petcoo00 2 2,460 Feb-02-2020, 08:46 PM
Last Post: snippsat
  Code syntax with underscore and assigning to a tuple santoshbwn 1 2,021 Jun-24-2019, 12:05 PM
Last Post: ThomasL

Forum Jump:

User Panel Messages

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